Skip to content
This repository was archived by the owner on Feb 13, 2021. It is now read-only.

Commit d312cb9

Browse files
author
Thiago C. D'Ávila
authored
Merge pull request #73 from staticdev/pytest-cov
Pytest cov
2 parents 5372717 + 903a1c5 commit d312cb9

5 files changed

Lines changed: 34 additions & 70 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,12 @@ jobs:
4141
- name: Run Nox
4242
run: |
4343
nox --force-color
44+
45+
- name: Create coverage report
46+
if: always() && matrix.session == 'tests'
47+
run: |
48+
nox --force-color --session=coverage -- xml
49+
50+
- name: Upload coverage report
51+
if: always() && matrix.session == 'tests'
52+
uses: codecov/codecov-action@v1.0.7

noxfile.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,20 @@ def mypy(session: Session) -> None:
137137
@nox.session(python=python_versions)
138138
def tests(session: Session) -> None:
139139
"""Run the test suite."""
140-
args = session.posargs or ["--cov"]
141140
install_package(session)
142-
install(session, "coverage[toml]", "pytest", "pytest-cov")
143-
session.run("pytest", *args)
141+
install(session, "coverage[toml]", "pytest")
142+
session.run("coverage", "run", "-m", "pytest", *session.posargs)
143+
session.run("coverage", "report")
144+
145+
146+
@nox.session
147+
def coverage(session: Session) -> None:
148+
"""Produce the coverage report."""
149+
args = session.posargs or ["report"]
150+
install(session, "coverage[toml]")
151+
if not session.posargs and any(Path().glob(".coverage.*")):
152+
session.run("coverage", "combine")
153+
session.run("coverage", *args)
144154

145155

146156
@nox.session(python=python_versions)

poetry.lock

Lines changed: 12 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ safety = "^1.9.0"
3131
mypy = "^0.770"
3232
pytest = "^5.4.2"
3333
coverage = {extras = ["toml"], version = "^5.0.4"}
34-
pytest-cov = "^2.8.1"
3534
typeguard = "^2.7.1"
3635
pre-commit = "^2.4.0"
3736

0 commit comments

Comments
 (0)