freebsd-ports/misc/py-pexpect/files/patch-tests_test__misc.py
Stefan Eßer a642f92e86 misc/py-pexpect: fix most of the test cases
A number of test cases included in the pexpect distribution failed on
FreeBSD. The patches included in the commit fix most of these tests.

One of the tests used /bin/bash and long options for the nl command.
Other tests assumed pipe buffers larger than provided by FreeBSD.

3 tests are still failing:

tests/test_replwrap.py::REPLWrapTestCase::test_existing_spawn FAILED

The text received contains bracketed paste escape characters when
a bash version 5.1 or newer is installed. There may be another problem
with this test, though, since it seems to depend on some bash rc file
of the account executing this test.

tests/test_socket.py::ExpectTestCase::test_interrupt FAILED
tests/test_socket.py::ExpectTestCase::test_multiple_interrupts FAILED

These two test seem to fail due to an early exit of the sending
process. It appears to be in Zombie state and cannot be signaled.
The "non-blocking read" seems to be blocking in this situation.

The real cause is unclear, it seems to be a mismatch between process
lifetime semantics in Linux and FreeBSD. I have removed an infinite
wait loop with these patches, which causes a test failure to be
detected (instead of preventing the execution of any further test
cases).

I have created a pull request on Github to get these patches into the
upstream, but it seems that the owner of the pexpect repository is not
very active.

Approved by:	sunpoet (maintainer)
2021-09-27 17:49:50 +02:00

20 lines
965 B
Python

--- tests/test_misc.py.orig 2020-01-17 17:08:15 UTC
+++ tests/test_misc.py
@@ -214,7 +214,7 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
# Force an invalid state to test isalive
child.ptyproc.terminated = 0
try:
- with self.assertRaisesRegexp(pexpect.ExceptionPexpect,
+ with self.assertRaisesRegex(pexpect.ExceptionPexpect,
".*" + expect_errmsg):
child.isalive()
finally:
@@ -224,7 +224,7 @@ class TestCaseMisc(PexpectTestCase.PexpectTestCase):
def test_bad_arguments_suggest_fdpsawn(self):
" assert custom exception for spawn(int). "
expect_errmsg = "maybe you want to use fdpexpect.fdspawn"
- with self.assertRaisesRegexp(pexpect.ExceptionPexpect,
+ with self.assertRaisesRegex(pexpect.ExceptionPexpect,
".*" + expect_errmsg):
pexpect.spawn(1)