diff --git a/.travis.yml b/.travis.yml index 373b79289..832274b1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,21 @@ jobs: python: '3.7' sudo: required dist: xenial + - &test-macos + language: generic + os: osx + osx_image: xcode9.4 + sudo: required + install: + - python -m pip install --pre tox + env: TOXENV=py27 + - <<: *test-macos + env: TOXENV=py37 + before_install: + - brew update + - brew upgrade python + - brew unlink python + - brew link python - stage: deploy python: '3.6' diff --git a/changelog/3888.bugfix.rst b/changelog/3888.bugfix.rst new file mode 100644 index 000000000..17e00a828 --- /dev/null +++ b/changelog/3888.bugfix.rst @@ -0,0 +1 @@ +Fix macOS specific code using ``capturemanager`` plugin in doctests. diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index 57d3367e4..12b871f9f 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -203,7 +203,8 @@ class DoctestItem(pytest.Item): return capman = self.config.pluginmanager.getplugin("capturemanager") if capman: - out, err = capman.suspend_global_capture(in_=True) + capman.suspend_global_capture(in_=True) + out, err = capman.read_global_capture() sys.stdout.write(out) sys.stderr.write(err) diff --git a/testing/python/fixture.py b/testing/python/fixture.py index f8f5eb54e..fc3eee42b 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1584,6 +1584,7 @@ class TestFixtureManagerParseFactories(object): values = [] """ ) + testdir.syspathinsert(testdir.tmpdir.dirname) package = testdir.mkdir("package") package.join("__init__.py").write("") package.join("conftest.py").write(