Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attrs 21.3.0 breaks coverage report on Python 3.6 (regression from 21.2.0) #895

Closed
andersk opened this issue Dec 28, 2021 · 8 comments · Fixed by #896
Closed

attrs 21.3.0 breaks coverage report on Python 3.6 (regression from 21.2.0) #895

andersk opened this issue Dec 28, 2021 · 8 comments · Fixed by #896

Comments

@andersk
Copy link

andersk commented Dec 28, 2021

With attrs 21.3.0, if I run a script that does import attr using coverage, I get an error from coverage report.

$ python3 --version
Python 3.6.15
$ echo 'import attr' > test.py
$ pip3 install attrs coverage

Successfully installed attrs-21.3.0 coverage-6.2
$ coverage run test.py
$ coverage report
No source for code: '/tmp/rep-1>'.

This worked with attrs 21.2.0.

$ pip3 install attrs==21.2.0

Successfully installed attrs-21.2.0
$ coverage run test.py
$ coverage report
Name      Stmts   Miss  Cover
-----------------------------
test.py       1      0   100%
-----------------------------
TOTAL         1      0   100%

I bisected the problem to commit 5a368d8 (#858). Cc @thetorpedodog @hynek.

@Tinche
Copy link
Member

Tinche commented Dec 29, 2021

Interesting. Could be a coverage bug? Not sure why this would break it.

@deadlylaid
Copy link

python 3.7 has same issue

working in CI/CD

Running with gitlab-runner 14.6.0~beta.71.gf035ecbf (f035ecbf)
  on green-5.shared.runners-manager.gitlab.com/default xS6Vzpvo
Preparing the "docker+machine" executor
Using Docker executor with image python:3.7-slim-buster ...
Pulling docker image python:3.7-slim-buster ...

[...]

Collecting attrs>=19.2.0
  Downloading attrs-21.3.0-py2.py3-none-any.whl (61 kB)
[...]

coverage report -i
/usr/local/lib/python3.7/site-packages/coverage/report.py:87: CoverageWarning: Couldn't parse '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-10>': No source for code: '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-10>'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")
/usr/local/lib/python3.7/site-packages/coverage/report.py:87: CoverageWarning: Couldn't parse '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-11>': No source for code: '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-11>'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")
/usr/local/lib/python3.7/site-packages/coverage/report.py:87: CoverageWarning: Couldn't parse '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-12>': No source for code: '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-12>'. (couldnt-parse)
  coverage._warn(msg, slug="couldnt-parse")
/usr/local/lib/python3.7/site-packages/coverage/report.py:87: CoverageWarning: Couldn't parse '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-13>': No source for code: '/builds/Jade/jade/jadeapp/jade-rest-auth/rep-13>'. (couldnt-parse)

[...]

coverage xml
No source for code: '/builds/DeepNatural/deepnaturalai/deepapi/deepapi-rest-auth/rep-10>'.
make: *** [Makefile:37: coverage] Error 1

but when i fixed attrs==21.2.0, its work

@hynek
Copy link
Member

hynek commented Dec 29, 2021

@nedbat any idea? 🤔

@hynek
Copy link
Member

hynek commented Dec 29, 2021

OK, I think I've got it. Could y'all have a look at #896 and tell me if it fixes your problems? I can cut a release later today if yes.

@hynek
Copy link
Member

hynek commented Dec 29, 2021

JFTR: the reason why it didn't come up in my own tests is because I always set a --source:

$ coverage run test.py; coverage report
No source for code: '/Users/hynek/tmp/rep-1>'.
$ coverage run --source test test.py; coverage report
Name      Stmts   Miss  Cover
-----------------------------
test.py       1      0   100%
-----------------------------
TOTAL         1      0   100%

@andersk
Copy link
Author

andersk commented Dec 29, 2021

Yeah, #896 works for me, both in my minimal test case and in my actual application (Zulip). Thanks for the quick fix!

@hynek
Copy link
Member

hynek commented Dec 29, 2021

Thank you for the quick confirmation!

@hynek
Copy link
Member

hynek commented Dec 29, 2021

21.4 is on PyPI – sorry for the regression and hope it's fixed now.

bors bot added a commit to ChrisRBe/PP-P2P-Parser that referenced this issue Jan 6, 2022
469: build(deps): bump attrs from 21.3.0 to 21.4.0 r=ChrisRBe a=dependabot[bot]

Bumps [attrs](https://github.com/python-attrs/attrs) from 21.3.0 to 21.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/python-attrs/attrs/releases">attrs's releases</a>.</em></p>
<blockquote>
<h2>21.4.0</h2>
<p>This is a quick bug fix release for a regression that causes <code>coverage report</code> fail under certain circumstances.</p>
<h1>Full Changelog</h1>
<h2>Changes</h2>
<ul>
<li>Fixed the test suite on PyPy3.8 where <code>cloudpickle</code> does not work. <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/892">#892</a></li>
<li>Fixed <code>coverage report</code> for projects that use <code>attrs</code> and don't set a <code>--source</code>. <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/895">#895</a>, <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/896">#896</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/python-attrs/attrs/blob/main/CHANGELOG.rst">attrs's changelog</a>.</em></p>
<blockquote>
<h2>21.4.0 (2021-12-29)</h2>
<p>Changes
^^^^^^^</p>
<ul>
<li>Fixed the test suite on PyPy3.8 where <code>cloudpickle</code> does not work.
<code>[#892](python-attrs/attrs#892) &lt;https://github.com/python-attrs/attrs/issues/892&gt;</code>_</li>
<li>Fixed <code>coverage report</code> for projects that use <code>attrs</code> and don't set a <code>--source</code>.
<code>[#895](python-attrs/attrs#895) &lt;https://github.com/python-attrs/attrs/issues/895&gt;</code><em>,
<code>[#896](python-attrs/attrs#896) &lt;https://github.com/python-attrs/attrs/issues/896&gt;</code></em></li>
</ul>
<hr />
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/python-attrs/attrs/commit/2de90143100e713d8ae6b5d1adb5e1e879af01fb"><code>2de9014</code></a> Prepare 21.4.0</li>
<li><a href="https://github.com/python-attrs/attrs/commit/02ba249b81a8d01ef6e7b04a7412556234aaa3bb"><code>02ba249</code></a> Remove dead anchors</li>
<li><a href="https://github.com/python-attrs/attrs/commit/1ff3f1ee919178946bb48442f1e183ea99dae373"><code>1ff3f1e</code></a> Minor changelog polish</li>
<li><a href="https://github.com/python-attrs/attrs/commit/0575d51ffddc0de465e7229571d11f9c6f6b8575"><code>0575d51</code></a> Make virtual repr file names unique (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/896">#896</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/03dd7136cf1ccc58c9612531ba9711892830c1fb"><code>03dd713</code></a> Do not require cloudpickle for PyPy (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/892">#892</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/ce50f40b52567564000af685959dc6df97c5f384"><code>ce50f40</code></a> Use correct words</li>
<li><a href="https://github.com/python-attrs/attrs/commit/9424a930f966ade789b1ea4b8043efe916c50769"><code>9424a93</code></a> Tell coverage about import attrs</li>
<li><a href="https://github.com/python-attrs/attrs/commit/c86fbc864862983111184eb9c3092afe2f2d477e"><code>c86fbc8</code></a> Use better word</li>
<li><a href="https://github.com/python-attrs/attrs/commit/7695908aa7b4a96fbfefb7432145f843ae9c0c98"><code>7695908</code></a> docs: fix very minor typo (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/894">#894</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/ada66bef24700d159acff4b72b7cb34a263ccccf"><code>ada66be</code></a> docs: remove typo in README.rst (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/893">#893</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/python-attrs/attrs/compare/21.3.0...21.4.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=attrs&package-manager=pip&previous-version=21.3.0&new-version=21.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
qujingpengf added a commit to qujingpengf/ChrisRBe that referenced this issue Jan 22, 2022
469: build(deps): bump attrs from 21.3.0 to 21.4.0 r=ChrisRBe a=dependabot[bot]

Bumps [attrs](https://github.com/python-attrs/attrs) from 21.3.0 to 21.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/python-attrs/attrs/releases">attrs's releases</a>.</em></p>
<blockquote>
<h2>21.4.0</h2>
<p>This is a quick bug fix release for a regression that causes <code>coverage report</code> fail under certain circumstances.</p>
<h1>Full Changelog</h1>
<h2>Changes</h2>
<ul>
<li>Fixed the test suite on PyPy3.8 where <code>cloudpickle</code> does not work. <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/892">#892</a></li>
<li>Fixed <code>coverage report</code> for projects that use <code>attrs</code> and don't set a <code>--source</code>. <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/895">#895</a>, <a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/896">#896</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/python-attrs/attrs/blob/main/CHANGELOG.rst">attrs's changelog</a>.</em></p>
<blockquote>
<h2>21.4.0 (2021-12-29)</h2>
<p>Changes
^^^^^^^</p>
<ul>
<li>Fixed the test suite on PyPy3.8 where <code>cloudpickle</code> does not work.
<code>[#892](python-attrs/attrs#892) &lt;https://github.com/python-attrs/attrs/issues/892&gt;</code>_</li>
<li>Fixed <code>coverage report</code> for projects that use <code>attrs</code> and don't set a <code>--source</code>.
<code>[#895](python-attrs/attrs#895) &lt;https://github.com/python-attrs/attrs/issues/895&gt;</code><em>,
<code>[#896](python-attrs/attrs#896) &lt;https://github.com/python-attrs/attrs/issues/896&gt;</code></em></li>
</ul>
<hr />
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/python-attrs/attrs/commit/2de90143100e713d8ae6b5d1adb5e1e879af01fb"><code>2de9014</code></a> Prepare 21.4.0</li>
<li><a href="https://github.com/python-attrs/attrs/commit/02ba249b81a8d01ef6e7b04a7412556234aaa3bb"><code>02ba249</code></a> Remove dead anchors</li>
<li><a href="https://github.com/python-attrs/attrs/commit/1ff3f1ee919178946bb48442f1e183ea99dae373"><code>1ff3f1e</code></a> Minor changelog polish</li>
<li><a href="https://github.com/python-attrs/attrs/commit/0575d51ffddc0de465e7229571d11f9c6f6b8575"><code>0575d51</code></a> Make virtual repr file names unique (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/896">#896</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/03dd7136cf1ccc58c9612531ba9711892830c1fb"><code>03dd713</code></a> Do not require cloudpickle for PyPy (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/892">#892</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/ce50f40b52567564000af685959dc6df97c5f384"><code>ce50f40</code></a> Use correct words</li>
<li><a href="https://github.com/python-attrs/attrs/commit/9424a930f966ade789b1ea4b8043efe916c50769"><code>9424a93</code></a> Tell coverage about import attrs</li>
<li><a href="https://github.com/python-attrs/attrs/commit/c86fbc864862983111184eb9c3092afe2f2d477e"><code>c86fbc8</code></a> Use better word</li>
<li><a href="https://github.com/python-attrs/attrs/commit/7695908aa7b4a96fbfefb7432145f843ae9c0c98"><code>7695908</code></a> docs: fix very minor typo (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/894">#894</a>)</li>
<li><a href="https://github.com/python-attrs/attrs/commit/ada66bef24700d159acff4b72b7cb34a263ccccf"><code>ada66be</code></a> docs: remove typo in README.rst (<a href="https://github-redirect.dependabot.com/python-attrs/attrs/issues/893">#893</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/python-attrs/attrs/compare/21.3.0...21.4.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=attrs&package-manager=pip&previous-version=21.3.0&new-version=21.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bastian-Krause added a commit to Bastian-Krause/labgrid that referenced this issue Nov 3, 2022
attrs 21.3.0 is breaking code coverage [1].

To fix this, bump attrs to 21.4.0.

[1] python-attrs/attrs#895

Signed-off-by: Bastian Krause <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants