hello, I’m on pants 1.22 (working on upgrade!), py...
# general
f
hello, I’m on pants 1.22 (working on upgrade!), pytest 3.6.4, and seeing this coverage error, it’s pretty random in our build, affects different files and does so very inconsistently. I can’t think of anything that differentiates affected files from unaffected ones others.
Copy code
internal error
Traceback (most recent call last):
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pytest-3.6.4-py2.py3-none-any.whl/_pytest/main.py", line 178, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pytest-3.6.4-py2.py3-none-any.whl/_pytest/main.py", line 215, in _main
    config.hook.pytest_runtestloop(session=session)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pluggy-0.7.1-py2.py3-none-any.whl/pluggy/hooks.py", line 258, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pluggy-0.7.1-py2.py3-none-any.whl/pluggy/manager.py", line 67, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pluggy-0.7.1-py2.py3-none-any.whl/pluggy/manager.py", line 61, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pluggy-0.7.1-py2.py3-none-any.whl/pluggy/callers.py", line 196, in _multicall
    gen.send(outcome)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pytest_cov-2.4.0-py2.py3-none-any.whl/pytest_cov/plugin.py", line 232, in pytest_runtestloop
    self.cov_controller.finish()
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/pytest_cov-2.4.0-py2.py3-none-any.whl/pytest_cov/engine.py", line 149, in finish
    self.cov.stop()
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl/coverage/control.py", line 687, in combine
    combine_parallel_data(self._data, aliases=aliases, data_paths=data_paths, strict=strict)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl/coverage/data.py", line 117, in combine_parallel_data
    data.update(new_data, aliases=aliases)
  File "/root/app/.pants.d/test/pytest-prep/CPython-3.6.4/6bb24d957dcc4c9000146a942b5ab04ed81cb1f1/.deps/coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl/coverage/sqldata.py", line 661, in update
    path, this_tracer, other_tracer
coverage.misc.CoverageException: Conflicting file tracer name for '/root/app/.pants.d/pyprep/sources/1f8c4b7129eaaea210c186d4118af8f20a186eb6/company/team/product/project/task.py': '' vs '__pants_backend_python_tasks_pytest_prep_coverage_plugin__.ChrootRemappingPlugin'
Is it something you guys have seen before? Happy to submit a github issue.
h
Hey Remi! I have not.. cc @witty-crayon-22786 @happy-kitchen-89482? GitHub issue would be great. Did you recently upgrade to 1.22 and only start seeing it since then?
f
yes, fairly recent and only started seeing on 1.22
h
Huh. Looking at the changelog to see if anything pops out..
And this is flaky, right? The worst type of bug.
f
oh, another important change was unpinning pytest-cov, previously it was pinned to 2.5.1
👍 1
yes it’s flakey
h
Oh, hm. Possibly related. How come you removed the pin?
f
due to pants upgrades, I wanted to let pants pick its default version
in the past, specifically for pytest versions, it seemed more reliable to use the default version
p
Note that pytest-cov only support coverage 5.x starting 2.8.0, see https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst#280-2019-10-04
h
I’m not seeing in the 1.22 changelog. I think this could be from removing the pin. When you run
./pants test
, what does Pytest output for the
pytest
version and for the
pytest-cov
version?
p
so if you are using coverage 5.1 you probably should use the latest pytest-cov
h
something like:
Copy code
platform darwin -- Python 3.6.10, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /private/var/folders/sx/pdpbqz4x5cscn9hhfpbsbqvm0000gn/T/process-executionHsKvX3
plugins: cov-2.8.1, icdiff-0.5, timeout-1.3.4
f
Copy code
platform linux -- Python 3.6.4, pytest-3.6.4, py-1.7.0, pluggy-0.7.1
rootdir: /root/app, inifile: /dev/null
plugins: cov-2.4.0, timeout-1.2.1, mock-1.6.2
👍 1
h
Ah, yeah it looks like it downgraded your coverage version. In 1.23.0, we bumped the defaults of everything, incuding
pytest-cov
defaulting to
>=2.8.1,<3
. In the meantime, you’ll want to add back either a pin to
==2.5.1
or newer.
p
also pytest 3.6 is super old (almost two years old)... you probably want to upgrade to a more recent version...
h
f
though if I can upgrade pytest already in 1.22 I will try that. Either way I’ll pin back to 2.5.1, and then unpin in my 1.22 upgrade PR probably
👍 1
really appreciate the help
❤️ 1
p
so your best short term solution is to use an older version of coverage, you should be able to do that by specifying it in the pytest_plugins settings in your pants.ini file
h
Hm, I didn’t realize #6282 was hitting users in the wild. I thought it was an issue only with this special test setup we use. Please let us know if you run into it! You’re welcome! Let us know how it goes. FYI we added this page yesterday to describe the benefits of the v2 engine and how to upgrade: https://pants.readme.io/docs/pants-v1-vs-v2. Even if you’re not able to upgrade to 1.28 yet and the v2 engine yet, this gets you closer to a better experience 🙂
f
I found that I could not upgrade to pytest 3.7+ at some point, although I’m not sure if the issue was the same as that described in 6282. But reading that issue I kept pytest pinned to 3.6.4 Thanks for the transition document! I will read it. @polite-garden-50641 yeah I imagine you’re right that downgrading coverage would make sense. when I pinned pytest-cov to 2.5.1, it appeared to resolve to coverage 5.0a5 . Maybe not ideal but I’ll start with getting to a known good state, otherwise I’ll downgrade coverage manually.
👍 1