JetBrains / teamcity-messages

Python Unit Test Reporting to TeamCity
https://pypi.python.org/pypi/teamcity-messages
Apache License 2.0
137 stars 81 forks source link

cannot run local test due to virtualenv incompatibility #230

Open cielavenir opened 4 years ago

cielavenir commented 4 years ago
____________________________________________________ ERROR at setup of test_teardown_module_error _____________________________________________________

request = <SubRequest 'venv' for <Function 'test_nested_suits'>>

    @pytest.fixture(scope='module')
    def venv(request):
        """
        Prepares a virtual environment for unittest, no extra packages required
        :rtype : virtual_environments.VirtualEnvDescription
        """
>       return virtual_environments.prepare_virtualenv()

request    = <SubRequest 'venv' for <Function 'test_nested_suits'>>

tests/integration-tests/unittest_integration_test.py:17: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

packages = ()

    def prepare_virtualenv(packages=()):
        """
        Prepares a virtual environment.
        :rtype : VirtualEnvDescription
        """
        vroot = get_vroot()
        env_key = get_env_key(packages)
        vdir = os.path.join(vroot, env_key)

        vbin = os.path.join(vdir, ('bin', 'Scripts')[_windows])
        vpython = os.path.join(vbin, 'python' + get_exe_suffix())
        vpip = os.path.join(vbin, 'pip' + get_exe_suffix())

        vpip_install = [vpip, "install"]
        if (2, 5) <= sys.version_info < (2, 6):
            vpip_install.append("--insecure")

        venv_description = VirtualEnvDescription(home_dir=vdir, bin_dir=vbin, python=vpython, pip=vpip, packages=packages)

        env = get_clean_system_environment()
        env['PIP_DOWNLOAD_CACHE'] = os.path.abspath(os.path.join(vroot, "pip-download-cache"))

        # Cache environment
        done_flag_file = os.path.join(vdir, "done")
        if not os.path.exists(done_flag_file):
            if os.path.exists(vdir):
                shutil.rmtree(vdir)

>           virtualenv.create_environment(vdir)
E           AttributeError: 'module' object has no attribute 'create_environment'

done_flag_file = '/tmp/teamcity-python-venv/2.7.13-posix/done'
env        = {'CLUTTER_IM_MODULE': 'xim', 'CMAKE_PREFIX_PATH': '/home/mujin/mujin/jhbuildappteachworker/install:', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'DESKTOP_SESSION': 'gnome-flashback-metacity', ...}
env_key    = '2.7.13-posix'
packages   = ()
vbin       = '/tmp/teamcity-python-venv/2.7.13-posix/bin'
vdir       = '/tmp/teamcity-python-venv/2.7.13-posix'
venv_description = <virtual_environments.VirtualEnvDescription instance at 0x7fda6d3cc368>
vpip       = '/tmp/teamcity-python-venv/2.7.13-posix/bin/pip'
vpip_install = ['/tmp/teamcity-python-venv/2.7.13-posix/bin/pip', 'install']
vpython    = '/tmp/teamcity-python-venv/2.7.13-posix/bin/python'
vroot      = '/tmp/teamcity-python-venv'

tests/integration-tests/virtual_environments.py:53: AttributeError
>>> virtualenv.__version__
'20.0.14'