Skip to content

Commit cec6b96

Browse files
mf2199c24t
authored andcommittedSep 15, 2020
feat: Stage 5 of nox implementation - adding coverage targets (#479)
1 parent 59e7c3f commit cec6b96

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
 

‎.coveragerc

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright 2020 Google LLC
4+
#
5+
# Use of this source code is governed by a BSD-style
6+
# license that can be found in the LICENSE file or at
7+
# https://developers.google.com/open-source/licenses/bsd
8+
9+
[run]
10+
branch = True
11+
12+
[report]
13+
fail_under = 100
14+
show_missing = True
15+
exclude_lines =
16+
# Re-enable the standard pragma
17+
pragma: NO COVER
18+
# Ignore debug-only repr
19+
def __repr__
20+
# Ignore abstract methods
21+
raise NotImplementedError
22+
omit =
23+
*/site-packages/*.py

‎noxfile.py

+19
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ def default(session):
6969
session.run(
7070
"py.test",
7171
"--quiet",
72+
"--cov=django_spanner",
73+
"--cov=spanner_dbapi",
74+
"--cov=tests.spanner_dbapi",
75+
"--cov-append",
76+
"--cov-config=.coveragerc",
77+
"--cov-report=",
78+
"--cov-fail-under=0",
7279
os.path.join("tests", "spanner_dbapi"),
7380
*session.posargs
7481
)
@@ -80,6 +87,18 @@ def unit(session):
8087
default(session)
8188

8289

90+
@nox.session(python="3.8")
91+
def cover(session):
92+
"""Run the final coverage report.
93+
94+
This outputs the coverage report aggregating coverage from the unit
95+
test runs (not system test runs), and then erases coverage data.
96+
"""
97+
session.install("coverage", "pytest-cov")
98+
session.run("coverage", "report", "--show-missing", "--fail-under=20")
99+
session.run("coverage", "erase")
100+
101+
83102
@nox.session(python="3.8")
84103
def docs(session):
85104
"""Build the docs for this library."""

0 commit comments

Comments
 (0)