From 8e51563384d5f955e0c3db363f2b498e77d14c22 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 03:00:32 +0200 Subject: [PATCH 1/4] 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 007423a9e..119c2542d 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -4,7 +4,6 @@ from __future__ import division from __future__ import print_function import os -import platform import sys import six @@ -153,10 +152,11 @@ class TestPDB(object): @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 fb12d2a612dc00dbc0a9f472b0cc6b305e00caf0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 May 2019 03:27:37 +0200 Subject: [PATCH 2/4] 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 119c2542d..0db3593d8 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -797,7 +797,6 @@ class TestPDB(object): 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 49c6aebbc7ab1a7fb7a58f6f3a61407175de0953 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 03:10:42 +0200 Subject: [PATCH 3/4] ci: Travis: test with pexpect on macos Uses `PYTEST_COVERAGE=1` already, which will come in via dropping Python 2 soon anyway. --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 728048cce..3136dec1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,9 +20,6 @@ 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 @@ -33,7 +30,7 @@ jobs: - 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,py37-xdist PYTEST_COVERAGE=1 before_install: - which python3 - python3 -V From 6896dbc5ca0b00ea7162ed3b31ebbea201c72fad Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 30 May 2019 03:52:41 +0200 Subject: [PATCH 4/4] tox: pexpect: use "-m uses_pexpect" --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a04f91ae5..0b1be0d33 100644 --- a/tox.ini +++ b/tox.ini @@ -40,7 +40,7 @@ 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 + pexpect: _PYTEST_TOX_POSARGS_PEXPECT=-m uses_pexpect twisted: _PYTEST_TOX_POSARGS_TWISTED=testing/test_unittest.py