From 314078ec6e015c37e60b30e007bc02694e69e011 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 10 Feb 2022 00:46:56 -0600 Subject: [PATCH] test: Consolidate and update pytest options in pyproject.toml (#121) * Remove .coveragerc and consolidate pytest options to pyproject.toml. * Apply 'configuring pytest' recommendations for pytest from Scikit-HEP (c.f. https://scikit-hep.org/developer/pytest#configuring-pytest ). - '-ra' includes a report after pytest runs with a summary on all tests except those that passed. From 'pytest --help': > -r chars: show extra test summary info as specified by chars: (f)ailed, > (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, > (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default > (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE'). - '-Wd' enables all warnings. > It adds 'd' to sys.warnoptions, which in turn adds a new first entry to > _warnings.filters which matches all warnings and enables the "default" > behavior, which is to show it once per execution of the Python interpreter. c.f. https://mail.python.org/pipermail/python-dev/2010-April/099116.html - '--showlocal' prints locals in tracebacks. - '--strict-markers' will complain if you use an unspecified fixture. - '--strict-config' will raise an error if there is a mistake in the pytest config. - 'log_cli_level = "info"' reports INFO and above log messages on a failure. * Remove '-r sx' from pytest calls in CI jobs as pyproject.toml now applies '-ra'. * Remove .coverage file added (accidentally?) in 134b6b4c2db3da65ee8198891049d1b8fdbdb2b4 --- .coveragerc | 13 ------------- .github/workflows/ci.yml | 2 +- pyproject.toml | 10 +++++++--- tests/testspecs/cartesian_mapreduce/.coverage | 1 - 4 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 .coveragerc delete mode 100644 tests/testspecs/cartesian_mapreduce/.coverage diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index f73a1ba2..00000000 --- a/.coveragerc +++ /dev/null @@ -1,13 +0,0 @@ -[run] -branch = True -source = src/yadage - -[report] -exclude_lines = - if self.debug: - pragma: no cover - raise NotImplementedError - if __name__ == .__main__.: -ignore_errors = True -omit = - tests/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0f1dca5..4eb8f769 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Test with pytest run: | - pytest -r sx + pytest - name: Report coverage with Codecov if: matrix.python-version == '3.10' diff --git a/pyproject.toml b/pyproject.toml index 799476f9..2de97e42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,12 +18,16 @@ exclude = ''' minversion = "6.0" xfail_strict = true addopts = [ - "--ignore=setup.py", - "--ignore=docs/", + "-ra", + "-Wd", "--cov=yadage", - "--cov-config=.coveragerc", + "--cov-branch", + "--showlocals", + "--strict-markers", + "--strict-config", "--cov-report=term-missing", "--cov-report=xml", "--cov-report=html", ] +log_cli_level = "info" testpaths = "tests" diff --git a/tests/testspecs/cartesian_mapreduce/.coverage b/tests/testspecs/cartesian_mapreduce/.coverage deleted file mode 100644 index fe8af938..00000000 --- a/tests/testspecs/cartesian_mapreduce/.coverage +++ /dev/null @@ -1 +0,0 @@ -!coverage.py: This is a private format, don't read it directly!{"lines":{}} \ No newline at end of file