From 1434b66c3543d9b7876501c03913d77ad9404c0f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 13 Aug 2019 17:54:40 +0200 Subject: [PATCH] pytester: spawn: skip without pexpect.spawn "pexpect" can be imported on Windows, but does not have "pexpect.spawn" then. Ref: https://github.com/pexpect/pexpect/blob/a803933ed53/pexpect/__init__.py#L73-L76 --- src/_pytest/pytester.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 80219b1a6..5835f01d1 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -1188,6 +1188,8 @@ class Testdir: pytest.skip("pypy-64 bit not supported") if sys.platform.startswith("freebsd"): pytest.xfail("pexpect does not work reliably on freebsd") + if not hasattr(pexpect, "spawn"): + pytest.skip("pexpect.spawn not available") logfile = self.tmpdir.join("spawn.out").open("wb") # Do not load user config.