def patch_django_nose():
    """Run 2to3 on django-nose and remove ``import new`` from its runner."""
    # FIXME: delete once django-nose supports Python 3 (bug #16).
    python = 'python' + '.'.join(map(str, sys.version_info[:2]))
    django_nose = os.path.join(
        VENV, 'lib', python, 'site-packages', 'django_nose')
    call('2to3', '-w', '--no-diffs', django_nose)
    with open(os.path.join(django_nose, 'runner.py'), 'r+') as f:
        lines = [line for line in f.readlines() if 'import new' not in line]
        f.seek(0)
        f.truncate()
        f.writelines(lines)
dataset/ETHPy150Open frankban/django-endless-pagination/tests/develop.py/patch_django_nose/original