Skip to content

Commit

Permalink
Fix coverage version mismatch between sessions
Browse files Browse the repository at this point in the history
Coverage.py 5.0 fails when faced with a .coverage data file generated by
an earlier version:

  Couldn't use data file 'path/to/.coverage': file is not a database

This affects us because coverage data is generated by the version
specified in poetry.lock (4.5.4), while the session uploading the
coverage data uses the latest version (5.0).

Fix the Nox session by querying Poetry to determine the pinned
coverage.py version, and install this instead.
  • Loading branch information
cjolowicz committed Dec 19, 2019
1 parent 2f9e2ce commit 32674c2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion noxfile.py
Expand Up @@ -59,7 +59,19 @@ def tests(session: Session) -> None:
@nox.session(python="3.8")
def coverage(session: Session) -> None:
"""Upload coverage data."""
session.install("coverage", "codecov")
output = session.run(
"poetry",
"export",
"--format=requirements.txt",
"--without-hashes",
"--dev",
external=True,
silent=True,
)
(coverage,) = [
line for line in output.splitlines() if line.startswith("coverage==")
]
session.install(coverage, "codecov")
session.run("coverage", "xml")
session.run("codecov", *session.posargs)

Expand Down

0 comments on commit 32674c2

Please sign in to comment.