Skip to content

Commit 72fc439

Browse files
authored
Merge pull request #5336 from blueyed/fix-pexpect
Fix pexpect tests on MacOS
2 parents f0a4a13 + 6896dbc commit 72fc439

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
include:
2121
# OSX tests - first (in test stage), since they are the slower ones.
2222
- &test-macos
23-
# NOTE: (tests with) pexpect appear to be buggy on Travis,
24-
# at least with coverage.
25-
# Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864
2623
os: osx
2724
osx_image: xcode10.1
2825
language: generic
@@ -33,7 +30,7 @@ jobs:
3330
- python -V
3431
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27
3532
- <<: *test-macos
36-
env: TOXENV=py37-xdist
33+
env: TOXENV=py37-pexpect,py37-xdist PYTEST_COVERAGE=1
3734
before_install:
3835
- which python3
3936
- python3 -V

testing/test_pdb.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import print_function
55

66
import os
7-
import platform
87
import sys
98

109
import six
@@ -153,10 +152,11 @@ def test_func():
153152

154153
@staticmethod
155154
def flush(child):
156-
if platform.system() == "Darwin":
157-
return
158155
if child.isalive():
156+
# Read if the test has not (e.g. test_pdb_unittest_skip).
157+
child.read()
159158
child.wait()
159+
assert not child.isalive()
160160

161161
def test_pdb_unittest_postmortem(self, testdir):
162162
p1 = testdir.makepyfile(
@@ -797,7 +797,6 @@ def test_post_mortem():
797797
rest = child.read().decode("utf8")
798798
assert "leave_pdb_hook" in rest
799799
assert "1 failed" in rest
800-
child.sendeof()
801800
self.flush(child)
802801

803802
def test_pdb_custom_cls(self, testdir, custom_pdb_calls):

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ setenv =
4040
lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof
4141

4242
pexpect: _PYTEST_TOX_PLATFORM=linux|darwin
43-
pexpect: _PYTEST_TOX_POSARGS_PEXPECT=testing/test_pdb.py testing/test_terminal.py testing/test_unittest.py
43+
pexpect: _PYTEST_TOX_POSARGS_PEXPECT=-m uses_pexpect
4444

4545
twisted: _PYTEST_TOX_POSARGS_TWISTED=testing/test_unittest.py
4646

0 commit comments

Comments
 (0)