From 1ec7f60484e85f96b994dba4ba4825227f6a17c1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 14 Feb 2019 15:25:51 +0100 Subject: [PATCH 1/6] codecov: use only linux/windows flags Using many flags are a reason for timeouts on Codecov's backend. --- .travis.yml | 2 +- scripts/upload-coverage.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8c6342ccc..ba2ba37f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,7 +105,7 @@ after_success: coverage combine coverage xml --ignore-errors coverage report -m --ignore-errors - bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F "${TOXENV//-/,},linux" + bash <(curl -s https://codecov.io/bash) -Z -X gcov -X coveragepy -X search -X xcode -X gcovout -X fix -f coverage.xml -F $TRAVIS_OS_NAME fi notifications: diff --git a/scripts/upload-coverage.bat b/scripts/upload-coverage.bat index 8a8d94c98..7391f817c 100644 --- a/scripts/upload-coverage.bat +++ b/scripts/upload-coverage.bat @@ -5,7 +5,7 @@ if not defined PYTEST_NO_COVERAGE ( C:\Python36\Scripts\coverage combine C:\Python36\Scripts\coverage xml --ignore-errors C:\Python36\Scripts\coverage report -m --ignore-errors - scripts\appveyor-retry C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags %TOXENV:-= % windows + scripts\appveyor-retry C:\Python36\Scripts\codecov --required -X gcov pycov search -f coverage.xml --flags windows ) else ( echo Skipping coverage upload, PYTEST_NO_COVERAGE is set ) From 15fe60aa251f70d37f117066db60f88b251b91f7 Mon Sep 17 00:00:00 2001 From: songbowen Date: Sun, 24 Feb 2019 00:24:56 +0800 Subject: [PATCH 2/6] add notice to use [tool:pytest] in setup.cfg --- doc/en/customize.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/en/customize.rst b/doc/en/customize.rst index 310b5c7b3..bcf23b53c 100644 --- a/doc/en/customize.rst +++ b/doc/en/customize.rst @@ -135,6 +135,7 @@ progress output, you can write it into a configuration file: # content of pytest.ini # (or tox.ini or setup.cfg) + # (use [tool:pytest] in setup.cfg cause [pytest] is no longer supported) [pytest] addopts = -ra -q From 6a4c7063fdbcb20ce209ca566ede9366842f531c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 23 Feb 2019 15:22:27 -0300 Subject: [PATCH 3/6] Fix docs about pytest conventions for test functions Fix #4818 --- doc/en/goodpractices.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/goodpractices.rst b/doc/en/goodpractices.rst index ba79e71f4..f08bd5c40 100644 --- a/doc/en/goodpractices.rst +++ b/doc/en/goodpractices.rst @@ -42,8 +42,8 @@ Conventions for Python test discovery * In those directories, search for ``test_*.py`` or ``*_test.py`` files, imported by their `test package name`_. * From those files, collect test items: - * ``test_`` prefixed test functions or methods outside of class - * ``test_`` prefixed test functions or methods inside ``Test`` prefixed test classes (without an ``__init__`` method) + * ``test`` prefixed test functions or methods outside of class + * ``test`` prefixed test functions or methods inside ``Test`` prefixed test classes (without an ``__init__`` method) For examples of how to customize your test discovery :doc:`example/pythoncollection`. From 3e11bd0d6e3ef8789471f5460e2e81fe97288795 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 23 Feb 2019 15:32:42 -0300 Subject: [PATCH 4/6] Update wording about [tool:pytest] in setup.cfg files --- doc/en/customize.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/en/customize.rst b/doc/en/customize.rst index bcf23b53c..2329ec2d1 100644 --- a/doc/en/customize.rst +++ b/doc/en/customize.rst @@ -133,9 +133,8 @@ progress output, you can write it into a configuration file: .. code-block:: ini - # content of pytest.ini - # (or tox.ini or setup.cfg) - # (use [tool:pytest] in setup.cfg cause [pytest] is no longer supported) + # content of pytest.ini or tox.ini + # setup.cfg files should use [tool:pytest] section instead [pytest] addopts = -ra -q From 2e89812fad8c30279a3fbaaf16ed580a864e6112 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 24 Feb 2019 13:21:00 -0300 Subject: [PATCH 5/6] Add unittest2 testing to trial environment Just noticed that `test_usefixtures_marker_on_unittest` is parametrized for unittest2, but no environment ever installed that library. --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 59879ead3..87a56f842 100644 --- a/tox.ini +++ b/tox.ini @@ -83,6 +83,7 @@ commands = deps = {[testenv]deps} twisted + unittest2 commands = {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:testing/test_unittest.py} From d9bdf5cfcad9510559eda6c3a4c5a1eb060b53e8 Mon Sep 17 00:00:00 2001 From: Zac-HD Date: Mon, 25 Feb 2019 22:30:49 +1100 Subject: [PATCH 6/6] Clarify docs on --strict marks --- doc/en/mark.rst | 6 ++++-- doc/en/reference.rst | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/en/mark.rst b/doc/en/mark.rst index d5c5c5735..e841a6780 100644 --- a/doc/en/mark.rst +++ b/doc/en/mark.rst @@ -29,9 +29,11 @@ which also serve as documentation. Raising errors on unknown marks: --strict ----------------------------------------- -When the ``--strict`` command-line flag is passed, any marks not registered in the ``pytest.ini`` file will trigger an error. +When the ``--strict`` command-line flag is passed, any unknown marks applied +with the ``@pytest.mark.name_of_the_mark`` decorator will trigger an error. +Marks defined or added by pytest or by a plugin will not trigger an error. -Marks can be registered like this: +Marks can be registered in ``pytest.ini`` like this: .. code-block:: ini diff --git a/doc/en/reference.rst b/doc/en/reference.rst index 24d5f7975..1ed5d91b1 100644 --- a/doc/en/reference.rst +++ b/doc/en/reference.rst @@ -1226,8 +1226,11 @@ passed multiple times. The expected format is ``name=value``. For example:: .. confval:: markers - List of markers that are allowed in test functions, enforced when ``--strict`` command-line argument is used. - You can use a marker name per line, indented from the option name. + When the ``--strict`` command-line argument is used, only known markers - + defined in code by core pytest or some plugin - are allowed. + You can list additional markers in this setting to add them to the whitelist. + + You can list one marker name per line, indented from the option name. .. code-block:: ini