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.