From fb4dd4744dd339459bd0c8334a5d8219df9a92f7 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 03:27:37 +0200 Subject: [PATCH 01/10] test_enter_leave_pdb_hooks_are_called: remove child.sendeof() --- testing/test_pdb.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 4b084a26a75..5a03f7d4976 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -797,7 +797,6 @@ def test_post_mortem(): rest = child.read().decode("utf8") assert "leave_pdb_hook" in rest assert "1 failed" in rest - child.sendeof() self.flush(child) def test_pdb_custom_cls(self, testdir, custom_pdb_calls): From 457b390e23fb266e9d92a5bd9bf8e2318b43c5c1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 02:37:48 +0200 Subject: [PATCH 02/10] ci: tox/Travis: use pexpect for dep only For https://github.com/pytest-dev/pytest/pull/5306 I would have to add `testing/test_pytester.py` to the default pos args, but that would run all other tests therein additionally. This also adds pexpect tests to the MacOS job, which appears to have caused trouble at least in the past, and likely needs fixing here before this works. --- .travis.yml | 14 ++++++-------- tox.ini | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index ecbba125586..df00db23bed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,8 @@ jobs: language: generic # Coverage for: # - py2 with symlink in test_cmdline_python_package_symlink. - env: TOXENV=py27-xdist PYTEST_COVERAGE=1 + # - _pytest.unittest._handle_skip (via pexpect). + env: TOXENV=py27-pexpect-xdist PYTEST_COVERAGE=1 before_install: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 @@ -62,8 +63,9 @@ jobs: # - pytester's LsofFdLeakChecker # - TestArgComplete (linux only) # - numpy + # - test_sys_breakpoint_interception (via pexpect). # Empty PYTEST_ADDOPTS to run this non-verbose. - - env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS= + - env: TOXENV=py37-lsof-numpy-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS= # Specialized factors for py27. - env: TOXENV=py27-nobyte-numpy-xdist @@ -72,9 +74,7 @@ jobs: python: '2.7' # Specialized factors for py37. - # Coverage for: - # - test_sys_breakpoint_interception (via pexpect). - - env: TOXENV=py37-pexpect,py37-twisted PYTEST_COVERAGE=1 + - env: TOXENV=py37-twisted PYTEST_COVERAGE=1 - env: TOXENV=py37-pluggymaster-xdist - env: TOXENV=py37-freeze @@ -84,9 +84,7 @@ jobs: if: type = cron - stage: baseline - # Coverage for: - # - _pytest.unittest._handle_skip (via pexpect). - env: TOXENV=py27-pexpect,py27-twisted PYTEST_COVERAGE=1 + env: TOXENV=py27-twisted PYTEST_COVERAGE=1 python: '2.7' # Use py36 here for faster baseline. - env: TOXENV=py36-xdist diff --git a/tox.ini b/tox.ini index 1f024b2f5ba..31925f8fdb3 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,7 @@ commands = coverage: coverage report passenv = USER USERNAME COVERAGE_* TRAVIS PYTEST_ADDOPTS setenv = - _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_PEXPECT:} {env:_PYTEST_TOX_POSARGS_TWISTED:} {env:_PYTEST_TOX_POSARGS_XDIST:} + _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_TWISTED:} {env:_PYTEST_TOX_POSARGS_XDIST:} # Configuration to run with coverage similar to Travis/Appveyor, e.g. # "tox -e py37-coverage". @@ -40,7 +40,6 @@ setenv = lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof pexpect: _PYTEST_TOX_PLATFORM=linux|darwin - pexpect: _PYTEST_TOX_POSARGS_PEXPECT=testing/test_pdb.py testing/test_terminal.py testing/test_unittest.py twisted: _PYTEST_TOX_POSARGS_TWISTED=testing/test_unittest.py From 2832e628267599398a7dc3d0692b524fc7c7684c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 03:00:32 +0200 Subject: [PATCH 03/10] tests: pdb: flush also on MacOS, but read() before Ref: https://github.com/pytest-dev/pytest/issues/2022 --- testing/test_pdb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 5a03f7d4976..195cab4de91 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -4,7 +4,6 @@ from __future__ import print_function import os -import platform import sys import six @@ -153,10 +152,11 @@ def test_func(): @staticmethod def flush(child): - if platform.system() == "Darwin": - return if child.isalive(): + # Read if the test has not (e.g. test_pdb_unittest_skip). + child.read() child.wait() + assert not child.isalive() def test_pdb_unittest_postmortem(self, testdir): p1 = testdir.makepyfile( From d47a331975643d5400492f0dfa23b6404583c07c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 19:56:39 +0200 Subject: [PATCH 04/10] TEMP: PYTEST_ADDOPTS=-vv -s for TOXENV=py37-lsof-numpy-pexpect-xdist --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index df00db23bed..419cd49c31b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ jobs: # - numpy # - test_sys_breakpoint_interception (via pexpect). # Empty PYTEST_ADDOPTS to run this non-verbose. - - env: TOXENV=py37-lsof-numpy-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS= + - env: TOXENV=py37-lsof-numpy-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" # Specialized factors for py27. - env: TOXENV=py27-nobyte-numpy-xdist From 2cc5b45f56975c036b9a412360e7b6b33076877f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 00:01:07 +0200 Subject: [PATCH 05/10] TEST: py37-lsof-numpy-pexpect-xdist => py37-pexpect-xdist --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 419cd49c31b..9cdf5516c00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ jobs: # - numpy # - test_sys_breakpoint_interception (via pexpect). # Empty PYTEST_ADDOPTS to run this non-verbose. - - env: TOXENV=py37-lsof-numpy-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" + - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" # Specialized factors for py27. - env: TOXENV=py27-nobyte-numpy-xdist From 26c42abbfe4791ec5a30aef16b9ac88887f31d07 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 00:01:21 +0200 Subject: [PATCH 06/10] TEMP: no Azure --- azure-pipelines.yml | 113 -------------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 8e50486de55..00000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,113 +0,0 @@ -trigger: -- master -- features - -variables: - PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml -vv" - python.needs_vc: False - COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage" - COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc" - PYTEST_COVERAGE: '0' - -jobs: - -- job: 'Test' - pool: - vmImage: "vs2017-win2016" - strategy: - matrix: - py27: - python.version: '2.7' - tox.env: 'py27' - py27-nobyte-lsof-numpy: - python.version: '2.7' - tox.env: 'py27-lsof-nobyte-numpy' - # Coverage for: - # - test_supports_breakpoint_module_global - # - test_terminal_reporter_writer_attr (without xdist) - # - "if write" branch in _pytest.assertion.rewrite - # - numpy - # - pytester's LsofFdLeakChecker (being skipped) - PYTEST_COVERAGE: '1' - py27-twisted: - python.version: '2.7' - tox.env: 'py27-twisted' - python.needs_vc: True - py27-pluggymaster-xdist: - python.version: '2.7' - tox.env: 'py27-pluggymaster-xdist' - # Coverage for: - # - except-IOError in _attempt_to_close_capture_file for py2. - # Also seen with py27-nobyte (using xdist), and py27-xdist. - # But no exception with py27-pexpect,py27-twisted,py27-numpy. - PYTEST_COVERAGE: '1' - # -- pypy2 and pypy3 are disabled for now: #5279 -- - # pypy: - # python.version: 'pypy2' - # tox.env: 'pypy' - # pypy3: - # python.version: 'pypy3' - # tox.env: 'pypy3' - py34-xdist: - python.version: '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' - # Coverage for: - # - test_supports_breakpoint_module_global - PYTEST_COVERAGE: '1' - py36-xdist: - python.version: '3.6' - tox.env: 'py36-xdist' - py37: - python.version: '3.7' - tox.env: 'py37' - # Coverage for: - # - _py36_windowsconsoleio_workaround (with py36+) - # - test_request_garbage (no xdist) - PYTEST_COVERAGE: '1' - py37-linting/docs/doctesting: - python.version: '3.7' - tox.env: 'linting,docs,doctesting' - py37-twisted/numpy: - python.version: '3.7' - tox.env: 'py37-twisted,py37-numpy' - py37-pluggymaster-xdist: - python.version: '3.7' - tox.env: 'py37-pluggymaster-xdist' - maxParallel: 10 - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '$(python.version)' - architecture: 'x64' - - - script: choco install vcpython27 - condition: eq(variables['python.needs_vc'], True) - displayName: 'Install VC for py27' - - - script: python -m pip install --upgrade pip && python -m pip install tox - displayName: 'Install tox' - - - script: | - call scripts/setup-coverage-vars.bat || goto :eof - python -m tox -e $(tox.env) - displayName: 'Run tests' - - - task: PublishTestResults@2 - inputs: - testResultsFiles: 'build/test-results/$(tox.env).xml' - testRunTitle: '$(tox.env)' - condition: succeededOrFailed() - - - script: call scripts\upload-coverage.bat - displayName: 'Report and upload coverage' - condition: eq(variables['PYTEST_COVERAGE'], '1') - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - PYTEST_CODECOV_NAME: $(tox.env) From a2d947577e0f902a7ad4dfcb2e7ceae6aeb50ede Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 00:02:34 +0200 Subject: [PATCH 07/10] TEMP: only py37-pexpect-xdist (moved for macos) --- .travis.yml | 66 +---------------------------------------------------- 1 file changed, 1 insertion(+), 65 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9cdf5516c00..f4b663b9018 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,21 +20,7 @@ jobs: include: # OSX tests - first (in test stage), since they are the slower ones. - &test-macos - # NOTE: (tests with) pexpect appear to be buggy on Travis, - # at least with coverage. - # Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864 - os: osx - osx_image: xcode10.1 - language: generic - # Coverage for: - # - py2 with symlink in test_cmdline_python_package_symlink. - # - _pytest.unittest._handle_skip (via pexpect). - env: TOXENV=py27-pexpect-xdist PYTEST_COVERAGE=1 - before_install: - - python -V - - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 - - <<: *test-macos - env: TOXENV=py37-xdist + env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V @@ -42,58 +28,8 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - # Full run of latest (major) supported versions, without xdist. - - env: TOXENV=py27 - python: '2.7' - - env: TOXENV=py37 - python: '3.7' - - # Coverage tracking is slow with pypy, skip it. - - env: TOXENV=pypy-xdist - python: 'pypy' - - env: TOXENV=pypy3-xdist - python: 'pypy3' - - - env: TOXENV=py34-xdist - python: '3.4' - - env: TOXENV=py35-xdist - python: '3.5' - - # Coverage for: - # - pytester's LsofFdLeakChecker - # - TestArgComplete (linux only) - # - numpy - # - test_sys_breakpoint_interception (via pexpect). - # Empty PYTEST_ADDOPTS to run this non-verbose. - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" - # Specialized factors for py27. - - env: TOXENV=py27-nobyte-numpy-xdist - python: '2.7' - - env: TOXENV=py27-pluggymaster-xdist - python: '2.7' - - # Specialized factors for py37. - - env: TOXENV=py37-twisted PYTEST_COVERAGE=1 - - env: TOXENV=py37-pluggymaster-xdist - - env: TOXENV=py37-freeze - - # 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-twisted PYTEST_COVERAGE=1 - python: '2.7' - # Use py36 here for faster baseline. - - env: TOXENV=py36-xdist - python: '3.6' - - env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1 - cache: - directories: - - $HOME/.cache/pre-commit - - stage: deploy python: '3.6' install: pip install -U setuptools setuptools_scm From 1c5c18952f0df6e16099bed184d98298b4af9a5c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 01:27:42 +0200 Subject: [PATCH 08/10] fixup! TEMP: only py37-pexpect-xdist (moved for macos) --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f4b663b9018..83347886845 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,9 @@ jobs: include: # OSX tests - first (in test stage), since they are the slower ones. - &test-macos + os: osx + osx_image: xcode10.1 + language: generic env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 before_install: - which python3 From fd2595fa75a1afa46d007a1fe3ef7f1634f214ec Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 01:28:06 +0200 Subject: [PATCH 09/10] linux: TOXENV=py37-pexpect-xdist => TOXENV=py37-pexpect --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 83347886845..c588ee7364f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ jobs: - python -V - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" + - env: TOXENV=py37-pexpect PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" - stage: deploy python: '3.6' From a0020b248b365cb2cdc2b23c4c6be8ece509d83a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 02:04:22 +0200 Subject: [PATCH 10/10] only linux: TOXENV=py37-pexpect, no PYTEST_ADDOPTS="-vv -s" --- .travis.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index c588ee7364f..84bb8b398b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,20 +18,7 @@ install: jobs: include: - # OSX tests - first (in test stage), since they are the slower ones. - - &test-macos - os: osx - osx_image: xcode10.1 - language: generic - env: TOXENV=py37-pexpect-xdist PYTEST_COVERAGE=1 - before_install: - - which python3 - - python3 -V - - ln -sfn "$(which python3)" /usr/local/bin/python - - python -V - - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37 - - - env: TOXENV=py37-pexpect PYTEST_COVERAGE=1 PYTEST_ADDOPTS="-vv -s" + - env: TOXENV=py37-pexpect PYTEST_COVERAGE=1 - stage: deploy python: '3.6'