From 068ce3d713e1bc42f7fb6b1bc475e6c014cb6ac1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 08:15:12 +0100 Subject: [PATCH 01/37] ci: Travis: revisit/fix coverage reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should bring coverage back that got missing with 9dcd6f2. 1. add PYTEST_COVERAGE to py37-pexpect,… job For `_pytest.debugging`, `Testdir.spawn`, `_pytest.terminal`. 2. re-add py37-xdist macos job This covers e.g. `_disable_output_capturing_for_darwin` again. NOTES: I have compared the coverage manually on Codecov, e.g. for `_pytest.debugging`: Before: https://codecov.io/gh/pytest-dev/pytest/src/ee62674322206299e0caaa36c172d9bb63feeaaf/src/_pytest/debugging.py After: https://codecov.io/gh/pytest-dev/pytest/src/9dcd6f2a87650f31f5b3b754e38a1cf4d6a14fe4/src/_pytest/debugging.py --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index be30f01516a..352f9cb48ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,13 @@ install: - python -m pip install --upgrade --pre tox env: matrix: - - TOXENV=py27 PYTEST_COVERAGE=1 + - TOXENV=py27 # Specialized factors for py27. - TOXENV=py27-nobyte PYTEST_COVERAGE=1 - TOXENV=py27-xdist PYTEST_COVERAGE=1 - TOXENV=py27-pluggymaster-xdist # Specialized factors for py37. - - TOXENV=py37-pexpect,py37-trial,py37-numpy + - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 - TOXENV=py37-pluggymaster-xdist - TOXENV=py37-freeze @@ -51,7 +51,7 @@ jobs: - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 env: TOXENV=py27-xdist - <<: *test-macos - env: TOXENV=py37-xdist + env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V From 45d6663a53bec80f6e4ce5a5474a64f682a21d44 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 12:23:16 +0100 Subject: [PATCH 02/37] Azure: no coverage --- azure-pipelines.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e27f03ee89e..ad060e249c3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,20 +20,16 @@ jobs: py27: python.version: '2.7' tox.env: 'py27' - PYTEST_COVERAGE: '1' py27-xdist: python.version: '2.7' tox.env: 'py27-xdist' - PYTEST_COVERAGE: '1' py27-numpy/nobyte: python.version: '2.7' tox.env: 'py27-numpy,py27-nobyte' - PYTEST_COVERAGE: '1' py27-trial: python.version: '2.7' tox.env: 'py27-trial' python.needs_vc: True - PYTEST_COVERAGE: '1' py27-pluggymaster-xdist: python.version: '2.7' tox.env: 'py27-pluggymaster-xdist' @@ -44,30 +40,24 @@ jobs: py34: python.version: '3.4' tox.env: 'py34' - PYTEST_COVERAGE: '1' py35: python.version: '3.5' tox.env: 'py35' - PYTEST_COVERAGE: '1' py36: python.version: '3.6' tox.env: 'py36' - PYTEST_COVERAGE: '1' py37: python.version: '3.7' tox.env: 'py37' - PYTEST_COVERAGE: '1' py37-linting/docs/doctesting: python.version: '3.7' tox.env: 'linting,docs,doctesting' py37-xdist: python.version: '3.7' tox.env: 'py37-xdist' - PYTEST_COVERAGE: '1' py37-trial/numpy: python.version: '3.7' tox.env: 'py37-trial,py37-numpy' - PYTEST_COVERAGE: '1' py37-pluggymaster-xdist: python.version: '3.7' tox.env: 'py37-pluggymaster-xdist' From 2cd9faa5c86a796dcb9f8570fc77b50da3772d98 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 12:24:34 +0100 Subject: [PATCH 03/37] Azure: use xdist with py34,py35,py36 --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ad060e249c3..7238a52571b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,13 +39,13 @@ jobs: python.exe: 'pypy' py34: python.version: '3.4' - tox.env: 'py34' + tox.env: 'py34-xdist' py35: python.version: '3.5' - tox.env: 'py35' + tox.env: 'py35-xdist' py36: python.version: '3.6' - tox.env: 'py36' + tox.env: 'py36-xdist' py37: python.version: '3.7' tox.env: 'py37' From bdbe13f456d1cab9517eec07031d1f745f0e8384 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 13:59:55 +0100 Subject: [PATCH 04/37] TEMP: Travis: only coverage jobs --- .travis.yml | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 352f9cb48ba..7ccde237dc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,15 +12,11 @@ install: - python -m pip install --upgrade --pre tox env: matrix: - - TOXENV=py27 # Specialized factors for py27. - TOXENV=py27-nobyte PYTEST_COVERAGE=1 - TOXENV=py27-xdist PYTEST_COVERAGE=1 - - TOXENV=py27-pluggymaster-xdist # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 - - TOXENV=py37-pluggymaster-xdist - - TOXENV=py37-freeze matrix: allow_failures: @@ -29,28 +25,10 @@ matrix: jobs: include: - # Coverage tracking is slow with pypy, skip it. - - env: TOXENV=pypy-xdist - python: 'pypy2.7-6.0' - - env: TOXENV=pypy3-xdist - python: 'pypy3.5-6.0' - - - env: TOXENV=py34-xdist - python: '3.4' - - env: TOXENV=py35-xdist - python: '3.5' - - env: TOXENV=py36-xdist - python: '3.6' - - env: TOXENV=py37 - &test-macos os: osx osx_image: xcode10.1 language: generic - before_install: - - python -V - - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 - env: TOXENV=py27-xdist - - <<: *test-macos env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 @@ -59,17 +37,6 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - # Jobs only run via Travis cron jobs (currently daily). - - env: TOXENV=py38-xdist - python: '3.8-dev' - if: type = cron - - - stage: baseline - env: TOXENV=py27-pexpect,py27-trial,py27-numpy - - env: TOXENV=py37-xdist - - env: TOXENV=linting,docs,doctesting - python: '3.7' - - stage: deploy python: '3.6' install: pip install -U setuptools setuptools_scm From 6e07279e891f990ce3f47d76741cde4031561fd4 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 14:01:24 +0100 Subject: [PATCH 05/37] TEMP: Azure: only single non-coverage job --- azure-pipelines.yml | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7238a52571b..d96fa84375c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,50 +17,9 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27: - python.version: '2.7' - tox.env: 'py27' - py27-xdist: - python.version: '2.7' - tox.env: 'py27-xdist' - py27-numpy/nobyte: - python.version: '2.7' - tox.env: 'py27-numpy,py27-nobyte' - py27-trial: - python.version: '2.7' - tox.env: 'py27-trial' - python.needs_vc: True - py27-pluggymaster-xdist: - python.version: '2.7' - tox.env: 'py27-pluggymaster-xdist' - pypy: - python.version: 'pypy' - tox.env: 'pypy' - python.exe: 'pypy' - py34: - python.version: '3.4' - tox.env: 'py34-xdist' - py35: - python.version: '3.5' - tox.env: 'py35-xdist' - py36: - python.version: '3.6' - tox.env: 'py36-xdist' - py37: - python.version: '3.7' - tox.env: 'py37' - py37-linting/docs/doctesting: - python.version: '3.7' - tox.env: 'linting,docs,doctesting' - py37-xdist: - python.version: '3.7' - tox.env: 'py37-xdist' py37-trial/numpy: python.version: '3.7' tox.env: 'py37-trial,py37-numpy' - py37-pluggymaster-xdist: - python.version: '3.7' - tox.env: 'py37-pluggymaster-xdist' maxParallel: 10 steps: From 0af34ab28ad257b6be387bd4ac716f6ed51096a7 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 14:28:59 +0100 Subject: [PATCH 06/37] azure: py37-xdist with coverage --- azure-pipelines.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d96fa84375c..73f2fbfa79d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,9 +17,10 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py37-trial/numpy: - python.version: '3.7' - tox.env: 'py37-trial,py37-numpy' + py37-xdist: + python.version: '2.7' + tox.env: 'py27-xdist' + PYTEST_COVERAGE: '1' maxParallel: 10 steps: From 17d2943ac5a738fd41699291ec06581c4eac87f0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 14:33:06 +0100 Subject: [PATCH 07/37] py27-xdist via Azure --- .travis.yml | 1 - azure-pipelines.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ccde237dc8..7fb23b09f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ env: matrix: # Specialized factors for py27. - TOXENV=py27-nobyte PYTEST_COVERAGE=1 - - TOXENV=py27-xdist PYTEST_COVERAGE=1 # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 73f2fbfa79d..d802e591675 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,7 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py37-xdist: + py27-xdist: python.version: '2.7' tox.env: 'py27-xdist' PYTEST_COVERAGE: '1' From b22de71a65ff28311c9ea71f328cb5ab94f6e869 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 15:45:48 +0100 Subject: [PATCH 08/37] TODO/mark (un)covered code --- src/_pytest/terminal.py | 5 ++++- src/_pytest/unittest.py | 1 + testing/test_pdb.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index eda0c0905b8..6deabeb841d 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -487,8 +487,11 @@ def _width_of_current_line(self): return self._tw.chars_on_current_line def pytest_collection(self): + # TODO: should be covered now if self.isatty: - if self.config.option.verbose >= 0: + if ( + self.config.option.verbose >= 0 + ): # TODO: should be covered (true branch only) self.write("collecting ... ", bold=True) self._collect_report_last_write = time.time() elif self.config.option.verbose >= 1: diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py index 58d79845b73..df70e1e0faf 100644 --- a/src/_pytest/unittest.py +++ b/src/_pytest/unittest.py @@ -220,6 +220,7 @@ def runtest(self): if self.config.pluginmanager.get_plugin("pdbinvoke") is None: self._testcase(result=self) else: + # TODO: should be covered now # disables tearDown and cleanups for post mortem debugging (see #1890) if self._handle_skip(): return diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 43d640614c1..c673defbdb3 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -149,6 +149,7 @@ def test_func(): @staticmethod def flush(child): + # TODO: should be covered now if platform.system() == "Darwin": return if child.isalive(): From e03b55285e95ddab7b3dfe163db29b34fc7db503 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 16:14:22 +0100 Subject: [PATCH 09/37] Azure: coverage with py35-xdist --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d802e591675..85f27bcc8e6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,12 @@ jobs: py27-xdist: python.version: '2.7' tox.env: 'py27-xdist' + # Coverage for test_supports_breakpoint_module_global + PYTEST_COVERAGE: '1' + py35-xdist: + python.version: '3.5' + tox.env: 'py35-xdist' + # Coverage for test_supports_breakpoint_module_global PYTEST_COVERAGE: '1' maxParallel: 10 From 41972528f4322b92066d55cb9e8e5f3e4d31fba4 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 16:17:34 +0100 Subject: [PATCH 10/37] test_pdb_interaction_on_internal_error: pragma: no branch --- testing/test_pdb.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index c673defbdb3..4cf7268768d 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -323,16 +323,12 @@ def pytest_runtest_protocol(): child.expect("Pdb") # INTERNALERROR is only displayed once via terminal reporter. - assert ( - len( - [ - x - for x in child.before.decode().splitlines() - if x.startswith("INTERNALERROR> Traceback") - ] - ) - == 1 - ) + error_lines = [ + x + for x in child.before.decode().splitlines() + if x.startswith("INTERNALERROR> Traceback") + ] # pragma: no branch + assert len(error_lines) == 1 child.sendeof() self.flush(child) From 7359606d9cad1be614c9e3ebb8ef42b9cd63e2fa Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 16:18:49 +0100 Subject: [PATCH 11/37] Travis: py37-pexpect-xdist for coverage of flush --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7fb23b09f18..9ebec9cd3f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ jobs: os: osx osx_image: xcode10.1 language: generic - env: TOXENV=py37-xdist PYTEST_COVERAGE=1 + env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V From 014f7b273c55deb0a0c0d380065c058d146acc81 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 16:38:22 +0100 Subject: [PATCH 12/37] Travis: baseline: use TOXENV=py37-pexpect-xdist Hangs with osx (also 2 failures): https://travis-ci.org/pytest-dev/pytest/jobs/499330023 --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9ebec9cd3f5..0de7898b47e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ jobs: os: osx osx_image: xcode10.1 language: generic - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 + env: TOXENV=py37-xdist before_install: - which python3 - python3 -V @@ -36,6 +36,9 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 + - stage: baseline + - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 + - stage: deploy python: '3.6' install: pip install -U setuptools setuptools_scm From 8cd8314cac66e2b9e36e28a632119dee3a0ffaca Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 16:39:55 +0100 Subject: [PATCH 13/37] Travis: PYTEST_ADDOPTS=-vv --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0de7898b47e..9b4a390cabf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ python: install: - python -m pip install --upgrade --pre tox env: + global: + - PYTEST_ADDOPTS=-vv matrix: # Specialized factors for py27. - TOXENV=py27-nobyte PYTEST_COVERAGE=1 @@ -37,7 +39,7 @@ jobs: - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - stage: baseline - - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 + env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 - stage: deploy python: '3.6' From 722d41a6a273ce1e880c681182af8dc434d5ce46 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 17:07:45 +0100 Subject: [PATCH 14/37] TOXENV=py37-xdist PYTEST_COVERAGE=1 with osx again --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b4a390cabf..03ca339fcf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ jobs: os: osx osx_image: xcode10.1 language: generic - env: TOXENV=py37-xdist + env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V @@ -38,9 +38,6 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - - stage: baseline - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 - - stage: deploy python: '3.6' install: pip install -U setuptools setuptools_scm From 99571837588d208329466c5e11a9f53d92f56934 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 17:07:56 +0100 Subject: [PATCH 15/37] ignore branch coverage with flush --- testing/test_pdb.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 4cf7268768d..30fdf978f71 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -149,11 +149,9 @@ def test_func(): @staticmethod def flush(child): - # TODO: should be covered now - if platform.system() == "Darwin": - return - if child.isalive(): - child.wait() + if platform.system() != "Darwin": # pragma: no branch + if child.isalive(): + child.wait() def test_pdb_unittest_postmortem(self, testdir): p1 = testdir.makepyfile( From 0598a8c19ef7fcf821b9357f1818eec3ea8dfc1f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 17:48:19 +0100 Subject: [PATCH 16/37] Revert: Travis: PYTEST_ADDOPTS=-vv --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 03ca339fcf6..7fb23b09f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ python: install: - python -m pip install --upgrade --pre tox env: - global: - - PYTEST_ADDOPTS=-vv matrix: # Specialized factors for py27. - TOXENV=py27-nobyte PYTEST_COVERAGE=1 From 167e36c5e1c018d4f5e3bd584738f0667368f272 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 19:42:12 +0100 Subject: [PATCH 17/37] TODO: non-empty sys.warnoptions not covered --- src/_pytest/warnings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index 76498573694..fad0084527e 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -74,6 +74,8 @@ def catch_warnings_for_item(config, ihook, when, item): inifilters = config.getini("filterwarnings") with warnings.catch_warnings(record=True) as log: + # TODO: the False branch is not covered anymore, but was still in 9dcd6f2a. + # I could not find where `python -W` would be run from. if not sys.warnoptions: # if user is not explicitly configuring warning filters, show deprecation warnings by default (#2908) warnings.filterwarnings("always", category=DeprecationWarning) From 359c47b0f93f3899d33d773da67fc62e536a50dd Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 27 Feb 2019 19:48:23 +0100 Subject: [PATCH 18/37] Azure: py35-lsof-xdist for coverage of lsof testing code --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 85f27bcc8e6..338c1e8616f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ jobs: PYTEST_COVERAGE: '1' py35-xdist: python.version: '3.5' - tox.env: 'py35-xdist' + tox.env: 'py35-lsof-xdist' # Coverage for test_supports_breakpoint_module_global PYTEST_COVERAGE: '1' maxParallel: 10 From 8293f3ff8f2adee67ecc57683329d17ff477547f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 18:32:48 +0100 Subject: [PATCH 19/37] Travis: add env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7fb23b09f18..d06410e88eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,11 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 + # Coverage for: + # - pdb / _test_pytest_function ?! + # Regressed in e3eb26f. But I've expected it to come via py37-pexpect already. + env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 + - stage: deploy python: '3.6' install: pip install -U setuptools setuptools_scm From e415e3b160b4203eaaceefc0137969f501de0435 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:27:17 +0100 Subject: [PATCH 20/37] fixup! Travis: add env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index d06410e88eb..04fb0987e83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,10 +36,10 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - # Coverage for: - # - pdb / _test_pytest_function ?! - # Regressed in e3eb26f. But I've expected it to come via py37-pexpect already. - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 + # Coverage for: + # - pdb / _test_pytest_function ?! + # Regressed in e3eb26f. But I've expected it to come via py37-pexpect already. + - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 - stage: deploy python: '3.6' From b39011565ddd9f97afb3b515e8d77967f72c17b1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:51:38 +0100 Subject: [PATCH 21/37] Revert "Azure: py35-lsof-xdist for coverage of lsof testing code" This reverts commit 359c47b0f93f3899d33d773da67fc62e536a50dd. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 338c1e8616f..85f27bcc8e6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ jobs: PYTEST_COVERAGE: '1' py35-xdist: python.version: '3.5' - tox.env: 'py35-lsof-xdist' + tox.env: 'py35-xdist' # Coverage for test_supports_breakpoint_module_global PYTEST_COVERAGE: '1' maxParallel: 10 From a850cd9c99b8006ada721dddfbdf0560ca983dba Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:55:33 +0100 Subject: [PATCH 22/37] Travis: TOXENV=py27-lsof-nobyte --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 04fb0987e83..d94e226d1bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,9 @@ install: env: matrix: # Specialized factors for py27. - - TOXENV=py27-nobyte PYTEST_COVERAGE=1 + # Coverage for: + # - pytester's LsofFdLeakChecker + - TOXENV=py27-lsof-nobyte PYTEST_COVERAGE=1 # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 From ac84f5d5e1dfe0f97b2872e77240fd801dd59aba Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:55:47 +0100 Subject: [PATCH 23/37] fixup! fixup! Travis: add env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d94e226d1bf..4f33a37c46f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,8 @@ jobs: # Coverage for: # - pdb / _test_pytest_function ?! - # Regressed in e3eb26f. But I've expected it to come via py37-pexpect already. + # Regressed in e3eb26f. + # But I've expected it to come via py37-pexpect already. TODO: Verify! - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 - stage: deploy From 62ea39fe3aa34d0ff24b66ee1081959611a7155c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:56:08 +0100 Subject: [PATCH 24/37] Azure: coverage with py27 without xdist --- azure-pipelines.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 85f27bcc8e6..cb3c5714bf3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,10 +17,12 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27-xdist: + py27: python.version: '2.7' - tox.env: 'py27-xdist' - # Coverage for test_supports_breakpoint_module_global + tox.env: 'py27' + # Coverage for: + # - test_supports_breakpoint_module_global + # - test_terminal_reporter_writer_attr (without xdist) PYTEST_COVERAGE: '1' py35-xdist: python.version: '3.5' From 56358d9d95bf3c8d0969e68cfa0eeb41c22fc1aa Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 20:58:56 +0100 Subject: [PATCH 25/37] Azure: py36-xdist for _py36_windowsconsoleio_workaround --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cb3c5714bf3..e2e62acc145 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,6 +29,12 @@ jobs: tox.env: 'py35-xdist' # Coverage for test_supports_breakpoint_module_global PYTEST_COVERAGE: '1' + py36-xdist: + python.version: '3.6' + tox.env: 'py36-xdist' + # Coverage for: + # - _py36_windowsconsoleio_workaround (could also be py36+) + PYTEST_COVERAGE: '1' maxParallel: 10 steps: From 428e30b0f3cdab8f2c284b24d65cdf99dba79d59 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 21:01:10 +0100 Subject: [PATCH 26/37] Revert "ignore branch coverage with flush" This reverts commit 99571837588d208329466c5e11a9f53d92f56934. --- testing/test_pdb.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 30fdf978f71..4cf7268768d 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -149,9 +149,11 @@ def test_func(): @staticmethod def flush(child): - if platform.system() != "Darwin": # pragma: no branch - if child.isalive(): - child.wait() + # TODO: should be covered now + if platform.system() == "Darwin": + return + if child.isalive(): + child.wait() def test_pdb_unittest_postmortem(self, testdir): p1 = testdir.makepyfile( From 75e88bc8da8920e7b9d0c54a8fc139709ecac119 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 21:13:33 +0100 Subject: [PATCH 27/37] TODO --- src/_pytest/compat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index fa878a485f3..234457a2f30 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -201,11 +201,14 @@ def _translate_non_printable(s): if PY35: + # TODO: only this is covered, but we have py37-xdist (osx)?! + # Might be good now via py36-xdist (linux). def _bytes_to_ascii(val): return val.decode("ascii", "backslashreplace") else: + # TODO: should get covered. def _bytes_to_ascii(val): if val: # source: http://goo.gl/bGsnwC From 4361b3cd9c1cc8fcf94bb31e08ba5b1191ab491c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 21:56:05 +0100 Subject: [PATCH 28/37] Azure: py34-xdist --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e2e62acc145..697f6ed2c47 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,6 +24,12 @@ jobs: # - test_supports_breakpoint_module_global # - test_terminal_reporter_writer_attr (without xdist) PYTEST_COVERAGE: '1' + py34-xdist: + python: '3.4' + tox.env: 'py34-xdist' + # Coverage for: + # - _pytest.compat._bytes_to_ascii + PYTEST_COVERAGE: '1' py35-xdist: python.version: '3.5' tox.env: 'py35-xdist' From 0e4b3550e10e295a04ee65917ecb2469c60303a0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:04:37 +0100 Subject: [PATCH 29/37] Revert "Travis: TOXENV=py27-lsof-nobyte" This reverts commit a850cd9c99b8006ada721dddfbdf0560ca983dba. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f33a37c46f..ff893e8d265 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,7 @@ install: env: matrix: # Specialized factors for py27. - # Coverage for: - # - pytester's LsofFdLeakChecker - - TOXENV=py27-lsof-nobyte PYTEST_COVERAGE=1 + - TOXENV=py27-nobyte PYTEST_COVERAGE=1 # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 From ef569a9802c9336175550f5325e8352fe5784f27 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:04:52 +0100 Subject: [PATCH 30/37] Azure: py27-nobyte --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 697f6ed2c47..bc0a5628b99 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,12 +17,13 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27: + py27-nobyte: python.version: '2.7' - tox.env: 'py27' + tox.env: 'py27-nobyte' # Coverage for: # - test_supports_breakpoint_module_global # - test_terminal_reporter_writer_attr (without xdist) + # - "if write" branch in _pytest.assertion.rewrite PYTEST_COVERAGE: '1' py34-xdist: python: '3.4' From f9f46146006f8212ada56ea25e877b96705dad1c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:19:03 +0100 Subject: [PATCH 31/37] doc --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index bc0a5628b99..df0311c2e83 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,6 +24,8 @@ jobs: # - test_supports_breakpoint_module_global # - test_terminal_reporter_writer_attr (without xdist) # - "if write" branch in _pytest.assertion.rewrite + # - also for more stable(?) isatty in _pytest.terminal + # (according to https://codecov.io/gh/pytest-dev/pytest/pull/4858/src/src/_pytest/terminal.py). PYTEST_COVERAGE: '1' py34-xdist: python: '3.4' From dd81bde1b80bb0ad9f0c254879da9a4012f7ab8e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:19:23 +0100 Subject: [PATCH 32/37] Travis: remove py27-nobyte - covered by Azure --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff893e8d265..7aaa017b073 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,6 @@ install: - python -m pip install --upgrade --pre tox env: matrix: - # Specialized factors for py27. - - TOXENV=py27-nobyte PYTEST_COVERAGE=1 # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 From 67cc480f3bbea68968254be5e14610e92c12e08e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:26:22 +0100 Subject: [PATCH 33/37] Azure: use existing py27-numpy/nobyte --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index df0311c2e83..25a8ea0fee2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,9 +17,9 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27-nobyte: + py27-numpy/nobyte: python.version: '2.7' - tox.env: 'py27-nobyte' + tox.env: 'py27-numpy,py27-nobyte' # Coverage for: # - test_supports_breakpoint_module_global # - test_terminal_reporter_writer_attr (without xdist) From 699f3fcb011809920bb59f8945e52802d89875e9 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:28:03 +0100 Subject: [PATCH 34/37] fixup! Azure: py34-xdist --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 25a8ea0fee2..34ffad6d184 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,7 +28,7 @@ jobs: # (according to https://codecov.io/gh/pytest-dev/pytest/pull/4858/src/src/_pytest/terminal.py). PYTEST_COVERAGE: '1' py34-xdist: - python: '3.4' + python.version: '3.4' tox.env: 'py34-xdist' # Coverage for: # - _pytest.compat._bytes_to_ascii From 88671640dd7b7e673227b9135fe95508cfc73f04 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:32:37 +0100 Subject: [PATCH 35/37] Bring back non-coverage jobs --- .travis.yml | 36 +++++++++++++++++++++++++++++++++++- azure-pipelines.yml | 19 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7aaa017b073..beded9e88a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,15 @@ install: - python -m pip install --upgrade --pre tox env: matrix: + - TOXENV=py27 + # Specialized factors for py27. + - TOXENV=py27-nobyte + - TOXENV=py27-xdist + - TOXENV=py27-pluggymaster-xdist # Specialized factors for py37. - - TOXENV=py37-pexpect,py37-trial,py37-numpy PYTEST_COVERAGE=1 + - TOXENV=py37-pexpect,py37-trial,py37-numpy + - TOXENV=py37-pluggymaster-xdist + - TOXENV=py37-freeze matrix: allow_failures: @@ -22,10 +29,28 @@ matrix: jobs: include: + # Coverage tracking is slow with pypy, skip it. + - env: TOXENV=pypy-xdist + python: 'pypy2.7-6.0' + - env: TOXENV=pypy3-xdist + python: 'pypy3.5-6.0' + + - env: TOXENV=py34-xdist + python: '3.4' + - env: TOXENV=py35-xdist + python: '3.5' + - env: TOXENV=py36-xdist + python: '3.6' + - env: TOXENV=py37 - &test-macos os: osx osx_image: xcode10.1 language: generic + env: TOXENV=py27-xdist + before_install: + - python -V + - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 + - <<: *test-macos env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 @@ -34,11 +59,20 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 + # Jobs only run via Travis cron jobs (currently daily). + - env: TOXENV=py38-xdist + python: '3.8-dev' + if: type = cron + + - stage: baseline # Coverage for: # - pdb / _test_pytest_function ?! # Regressed in e3eb26f. # But I've expected it to come via py37-pexpect already. TODO: Verify! - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 + - env: TOXENV=py37-xdist + - env: TOXENV=linting,docs,doctesting + python: '3.7' - stage: deploy python: '3.6' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 34ffad6d184..9ad89885530 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,6 +17,12 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: + py27: + python.version: '2.7' + tox.env: 'py27' + py27-xdist: + python.version: '2.7' + tox.env: 'py27-xdist' py27-numpy/nobyte: python.version: '2.7' tox.env: 'py27-numpy,py27-nobyte' @@ -27,6 +33,19 @@ jobs: # - also for more stable(?) isatty in _pytest.terminal # (according to https://codecov.io/gh/pytest-dev/pytest/pull/4858/src/src/_pytest/terminal.py). PYTEST_COVERAGE: '1' + py27-trial: + python.version: '2.7' + tox.env: 'py27-trial' + python.needs_vc: True + # TODO: check + # PYTEST_COVERAGE: '1' + py27-pluggymaster-xdist: + python.version: '2.7' + tox.env: 'py27-pluggymaster-xdist' + pypy: + python.version: 'pypy' + tox.env: 'pypy' + python.exe: 'pypy' py34-xdist: python.version: '3.4' tox.env: 'py34-xdist' From 13dde1a292da73ec6a05e014d49bc8b4a817c673 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:49:38 +0100 Subject: [PATCH 36/37] TEMP: only coverage jobs --- .travis.yml | 34 ---------------------------------- azure-pipelines.yml | 13 ------------- 2 files changed, 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index beded9e88a2..50c51e3a6fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,15 +12,8 @@ install: - python -m pip install --upgrade --pre tox env: matrix: - - TOXENV=py27 - # Specialized factors for py27. - - TOXENV=py27-nobyte - - TOXENV=py27-xdist - - TOXENV=py27-pluggymaster-xdist # Specialized factors for py37. - TOXENV=py37-pexpect,py37-trial,py37-numpy - - TOXENV=py37-pluggymaster-xdist - - TOXENV=py37-freeze matrix: allow_failures: @@ -29,28 +22,10 @@ matrix: jobs: include: - # Coverage tracking is slow with pypy, skip it. - - env: TOXENV=pypy-xdist - python: 'pypy2.7-6.0' - - env: TOXENV=pypy3-xdist - python: 'pypy3.5-6.0' - - - env: TOXENV=py34-xdist - python: '3.4' - - env: TOXENV=py35-xdist - python: '3.5' - - env: TOXENV=py36-xdist - python: '3.6' - - env: TOXENV=py37 - &test-macos os: osx osx_image: xcode10.1 language: generic - env: TOXENV=py27-xdist - before_install: - - python -V - - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 - - <<: *test-macos env: TOXENV=py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 @@ -59,20 +34,11 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - # Jobs only run via Travis cron jobs (currently daily). - - env: TOXENV=py38-xdist - python: '3.8-dev' - if: type = cron - - - stage: baseline # Coverage for: # - pdb / _test_pytest_function ?! # Regressed in e3eb26f. # But I've expected it to come via py37-pexpect already. TODO: Verify! - env: TOXENV=py27-pexpect,py27-trial,py27-numpy PYTEST_COVERAGE=1 - - env: TOXENV=py37-xdist - - env: TOXENV=linting,docs,doctesting - python: '3.7' - stage: deploy python: '3.6' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9ad89885530..eed80974005 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,12 +17,6 @@ jobs: vmImage: "vs2017-win2016" strategy: matrix: - py27: - python.version: '2.7' - tox.env: 'py27' - py27-xdist: - python.version: '2.7' - tox.env: 'py27-xdist' py27-numpy/nobyte: python.version: '2.7' tox.env: 'py27-numpy,py27-nobyte' @@ -39,13 +33,6 @@ jobs: python.needs_vc: True # TODO: check # PYTEST_COVERAGE: '1' - py27-pluggymaster-xdist: - python.version: '2.7' - tox.env: 'py27-pluggymaster-xdist' - pypy: - python.version: 'pypy' - tox.env: 'pypy' - python.exe: 'pypy' py34-xdist: python.version: '3.4' tox.env: 'py34-xdist' From a4d82c1b9452fb54ca90ed080ece77272030743b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 22:50:13 +0100 Subject: [PATCH 37/37] TODO: check py27-trial --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index eed80974005..a355726a5a4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -31,8 +31,8 @@ jobs: python.version: '2.7' tox.env: 'py27-trial' python.needs_vc: True - # TODO: check - # PYTEST_COVERAGE: '1' + # TODO: check if coverage is necessary/useful here. + PYTEST_COVERAGE: '1' py34-xdist: python.version: '3.4' tox.env: 'py34-xdist'