Merge pull request #5336 from blueyed/fix-pexpect

Fix pexpect tests on MacOS
This commit is contained in:
Daniel Hahler 2019-05-30 06:31:11 +02:00 committed by GitHub
commit 72fc43952b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View File

@ -20,9 +20,6 @@ jobs:
include: include:
# OSX tests - first (in test stage), since they are the slower ones. # OSX tests - first (in test stage), since they are the slower ones.
- &test-macos - &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 os: osx
osx_image: xcode10.1 osx_image: xcode10.1
language: generic language: generic
@ -33,7 +30,7 @@ jobs:
- python -V - python -V
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27 - test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27
- <<: *test-macos - <<: *test-macos
env: TOXENV=py37-xdist env: TOXENV=py37-pexpect,py37-xdist PYTEST_COVERAGE=1
before_install: before_install:
- which python3 - which python3
- python3 -V - python3 -V

View File

@ -4,7 +4,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import os import os
import platform
import sys import sys
import six import six
@ -153,10 +152,11 @@ class TestPDB(object):
@staticmethod @staticmethod
def flush(child): def flush(child):
if platform.system() == "Darwin":
return
if child.isalive(): if child.isalive():
# Read if the test has not (e.g. test_pdb_unittest_skip).
child.read()
child.wait() child.wait()
assert not child.isalive()
def test_pdb_unittest_postmortem(self, testdir): def test_pdb_unittest_postmortem(self, testdir):
p1 = testdir.makepyfile( p1 = testdir.makepyfile(
@ -797,7 +797,6 @@ class TestPDB(object):
rest = child.read().decode("utf8") rest = child.read().decode("utf8")
assert "leave_pdb_hook" in rest assert "leave_pdb_hook" in rest
assert "1 failed" in rest assert "1 failed" in rest
child.sendeof()
self.flush(child) self.flush(child)
def test_pdb_custom_cls(self, testdir, custom_pdb_calls): def test_pdb_custom_cls(self, testdir, custom_pdb_calls):

View File

@ -40,7 +40,7 @@ setenv =
lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof
pexpect: _PYTEST_TOX_PLATFORM=linux|darwin 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 twisted: _PYTEST_TOX_POSARGS_TWISTED=testing/test_unittest.py