I specify installing pytest
in Drone pipeline as below:
pip install -q pytest
it used to work well until a few days ago when it suddenly showed below error:
+ python -m pytest test/test_dai_adrecogzer.py
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/pytest.py", line 14, in <module>
from _pytest.fixtures import fillfixtures as _fillfuncargs
File "/usr/local/lib/python2.7/dist-packages/_pytest/fixtures.py", line 16, in <module>
from more_itertools import flatten
File "/usr/local/lib/python2.7/dist-packages/more_itertools/__init__.py", line 1, in <module>
from more_itertools.more import * # noqa
File "/usr/local/lib/python2.7/dist-packages/more_itertools/more.py", line 329
def _collate(*iterables, key=lambda a: a, reverse=False):
^
SyntaxError: invalid syntax
Searching around I found a recently post SO question that seems to closely link to what I am looking for. The reason seems to be because of recently released version 6.0 of more-itertools
. The accepted answer suggests to spin
to some specific version of more-itertools
:
setuptools.setup(
setup_requires=['pytest-runner'],
tests_require=['mock', 'more-itertools<6.0.0', 'pytest'],
test_suite='tests',
python_requires='>=2.7',
)
How could I apply this suggestion to my issue? More specifically, how could I specify version <6.0.0
of more-itertools
when install pytest
using pip install -q pytest
command?