From 1c9464285f620875631f4d06b389e2e0060501b3 Mon Sep 17 00:00:00 2001 From: "STATION\\mf" Date: Mon, 31 Aug 2020 14:11:53 -0400 Subject: [PATCH 1/3] feat: added coverage targets --- .coveragerc | 23 +++++++++++++++++++++++ noxfile.py | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000000..b1a1aa9cf5 --- /dev/null +++ b/.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 \ No newline at end of file diff --git a/noxfile.py b/noxfile.py index 04b4694086..af4733ef80 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,6 +23,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, ) @@ -34,6 +41,18 @@ def unit(session): default(session) +@nox.session(python="3.7") +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=99") + session.run("coverage", "erase") + + @nox.session(python="3.8") def docs(session): """Build the docs for this library.""" From 417fe70bcb6a37d5238c5c9fd53995dd7b285765 Mon Sep 17 00:00:00 2001 From: "STATION\\mf" Date: Mon, 31 Aug 2020 14:24:44 -0400 Subject: [PATCH 2/3] fix: typo --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index af4733ef80..5dca3a91fc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -41,7 +41,7 @@ def unit(session): default(session) -@nox.session(python="3.7") +@nox.session(python="3.8") def cover(session): """Run the final coverage report. From aa89a08b480b96ed4bd87f8cff88467778bdb29e Mon Sep 17 00:00:00 2001 From: "STATION\\mf" Date: Mon, 31 Aug 2020 16:23:12 -0400 Subject: [PATCH 3/3] fix: temporarily lowered coverage threshold --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 010b94a1e6..016fe33c39 100644 --- a/noxfile.py +++ b/noxfile.py @@ -95,7 +95,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=20") session.run("coverage", "erase")