I’m seeing a similar issue with zipp, but I’m on p...
# general
c
I’m seeing a similar issue with zipp, but I’m on pants 1.16. But when I add
Copy code
[pytest]
pytest_plugins: +["zipp==1.0.0"]
I see this error
17:18:53 [ERROR] Invalid option 'pytest_plugins' under [pytest]
What is the right way to pin zipp for pants 1.16?
w
./pants options | grep pytest
should show some candidates.
c
I see
Copy code
cache.test.pytest.ignore = True (from CONFIG in pants.ini)
pytest.cov_requirements = pytest-cov>=2.4,<2.5 (from HARDCODED)
pytest.requirements = pytest==4.6.5 (from CONFIG in pants.ini)
pytest.timeout_requirements = pytest-timeout>=1.2,<1.3 (from HARDCODED)
pytest.unittest2_requirements = unittest2>=0.6.0,<=1.9.0 (from HARDCODED)
test.pytest.chroot = False (from HARDCODED)
test.pytest.coverage = None (from NONE)
test.pytest.coverage_output_dir = None (from NONE)
test.pytest.extra_pythonpath = ['/Users/johndowns/aiq/.pants.d/ivy/jars/graphframes/graphframes/jars/graphframes-0.5.0-spark2.1-s_2.10.jar'] (from CONFIG in pants.ini)
test.pytest.fast = True (from HARDCODED)
test.pytest.junit_xml_dir = None (from NONE)
test.pytest.options = [] (from NONE)
test.pytest.profile = None (from NONE)
test.pytest.skip = False (from HARDCODED)
test.pytest.test_shard = None (from NONE)
test.pytest.timeout_default = None (from NONE)
test.pytest.timeout_maximum = None (from NONE)
test.pytest.timeout_terminate_wait = 10 (from HARDCODED)
test.pytest.timeouts = True (from HARDCODED)
I’ll start with
pytest.requirements
and see if that pans out
h
Yes, in 1.16 it would look like this:
Copy code
[pytest]
requirements: +["zipp==1.0.0"]
c
Copy code
16:10:44 01:58   [compile]
16:10:44 01:58     [node]
16:10:44 01:58     [compile-jvm-prep-command]
16:10:44 01:58       [jvm_prep_command]
16:10:44 01:58     [compile-prep-command]
16:10:44 01:58     [compile]
16:10:44 01:58     [rsc]
16:10:44 01:58     [zinc]
16:10:44 01:58     [javac]
16:10:44 01:58   [test]
16:10:44 01:58     [test-jvm-prep-command]
16:10:44 01:58       [jvm_prep_command]
16:10:44 01:58     [test-prep-command]
16:10:44 01:58       [prep_command]
16:12:45 03:59     [legacy]
16:12:45 03:59     [pytest-prep]
16:12:45 03:59       [cache]
                   No cached artifacts for 68 targets.
                   Invalidated 68 targets.
               Waiting for background workers to finish.
16:12:48 04:02   [complete]
               FAILURE
timestamp: 2020-01-22T16:12:48.867080
Exception caught: (pkg_resources.RequirementParseError)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/bin/pants", line 8, in <module>
    sys.exit(main())
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 85, in main
    PantsLoader.run()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 81, in run
    cls.load_and_execute(entrypoint)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/pants_loader.py", line 74, in load_and_execute
    entrypoint_main()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/pants_exe.py", line 39, in main
    PantsRunner(exiter, start_time=start_time).run()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/pants_runner.py", line 88, in run
    return runner.run()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 231, in run
    self._run()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 292, in _run
    goal_runner_result = self._maybe_run_v1()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/local_pants_runner.py", line 259, in _maybe_run_v1
    return goal_runner_factory.create().run()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/goal_runner.py", line 209, in run
    return self._run_goals()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/goal_runner.py", line 180, in _run_goals
    result = self._execute_engine()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/bin/goal_runner.py", line 168, in _execute_engine
    result = engine.execute(self._context, self._goals)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/engine/legacy_engine.py", line 26, in execute
    self.attempt(context, goals)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/engine/round_engine.py", line 234, in attempt
    goal_executor.attempt(explain)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/engine/round_engine.py", line 50, in attempt
    task.execute()
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/backend/python/tasks/pytest_prep.py", line 97, in execute
    pytest_binary = self.create_pex(pex_info)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/backend/python/tasks/python_execution_task_base.py", line 157, in create_pex
    interpreter, self.extra_requirements())
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/backend/python/tasks/resolve_requirements_task_base.py", line 112, in resolve_requirement_strings
    reqs = [PythonRequirement(req_str) for req_str in requirement_strings]
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pants/backend/python/python_requirement.py", line 38, in __init__
    self._requirement = Requirement.parse(requirement)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3023, in parse
    req, = parse_requirements(s)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2970, in parse_requirements
    yield Requirement(line)
  File "/Users/johndowns/.cache/pants/setup/bootstrap-Darwin-x86_64/1.16.0_py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2979, in __init__
    raise RequirementParseError(str(e))

Exception message: Invalid requirement, parse error at "u'+["zipp='"
I am seeing this error now
w
it's probably not a list option. try just:
Copy code
[pytest]
requirements: pytest==4.6.5,zipp==1.0.0
c
Exception message: Invalid requirement, parse error at "u',zipp==1'"
That doesn’t seem much better 😕
lemme try quotes around that
that’s not it
Exception message: Invalid requirement, parse error at "u'"pytest='"
h
Ah tricky. I forgot that
requirements
isn’t a list option. This is why we deprecated it in favor of
version
and
pytest_plugins
. What you can do is override
unittest2_requirements
(I think that’s the name iirc) to be
zipp==1.0.0
like this:
Copy code
[pytest]
unittest2_requirements: zipp==1.0.0
Unittest2 is only used for Python <2.7, so hopefully not at all relevant to you and safe to override.
🙇‍♀️ 1