I have a python repository with travis ci integration which installs the dependencies, code and runs tests using py.test on both python 3.6+ and python 2.7, for a while. Recently the tests broke (without code changes), and I replaced py.test
calls by pytest
and got the 3.6 version working. However, I am unable to get the python 2.7 version working: Some of the variations I tried:
- even after adding a
pytest
to pip-requirements pinning the version to<3.3.0
. - trying
py.test
instead. - increasing the install time (should not have worked).
The error I get is : https://travis-ci.com/LSSTDESC/OpSimSummary/builds/121299634?utm_medium=notification&utm_source=email
Traceback (most recent call last):
File "/home/travis/miniconda/bin/py.test", line 10, in <module>
sys.exit(main())
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/config.py", line 49, in main
config = _prepareconfig(args, plugins)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/config.py", line 168, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result
_reraise(*ex) # noqa
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
self.result = func()
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/config.py", line 957, in pytest_cmdline_parse
self.parse(args)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/config.py", line 1121, in parse
self._preparse(args, addopts=addopts)
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/config.py", line 1084, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "/home/travis/miniconda/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 515, in load_setuptools_entrypoints
"Plugin %r could not be loaded: %s!" % (ep.name, e))
_pytest.vendored_packages.pluggy.PluginValidationError: Plugin 'pytest_cov' could not be loaded: (pytest 3.2.5 (/home/travis/miniconda/lib/python2.7/site-packages), Requirement.parse('pytest>=3.6'))!
The command "py.test tests" exited with 1.```
An obvious solution is to stop supporting Python 2.7, but I was wondering if there could be a different solution.