Skip to content

Commit

Permalink
feat: Stage 5 of nox implementation - adding coverage targets (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
mf2199 authored and c24t committed Sep 15, 2020
1 parent 59e7c3f commit cec6b96
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .coveragerc
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd

[run]
branch = True

[report]
fail_under = 100
show_missing = True
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore abstract methods
raise NotImplementedError
omit =
*/site-packages/*.py
19 changes: 19 additions & 0 deletions noxfile.py
Expand Up @@ -69,6 +69,13 @@ def default(session):
session.run(
"py.test",
"--quiet",
"--cov=django_spanner",
"--cov=spanner_dbapi",
"--cov=tests.spanner_dbapi",
"--cov-append",
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
os.path.join("tests", "spanner_dbapi"),
*session.posargs
)
Expand All @@ -80,6 +87,18 @@ def unit(session):
default(session)


@nox.session(python="3.8")
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=20")
session.run("coverage", "erase")


@nox.session(python="3.8")
def docs(session):
"""Build the docs for this library."""
Expand Down

0 comments on commit cec6b96

Please sign in to comment.