[issue39653] test_posix fails during make test

Terry J. Reedy report at bugs.python.org
Sun Feb 23 20:23:48 EST 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

My understanding that Python is compiled and installed and that the failure was during a later test.

In repository master (3.9) the line is 1549 instead of 1529.  The test function code is

    def test_no_such_executable(self):
        no_such_executable = 'no_such_executable'
        try:
            pid = self.spawn_func(no_such_executable,
                                  [no_such_executable],
                                  os.environ)
        # bpo-35794: PermissionError can be raised if there are
        # directories in the $PATH that are not accessible.
        except (FileNotFoundError, PermissionError) as exc:
            self.assertEqual(exc.filename, no_such_executable)
        else:
            pid2, status = os.waitpid(pid, 0)
            self.assertEqual(pid2, pid)
            self.assertNotEqual(status, 0)

It is part of a mixin class and once mixed in, spawn_func is either posix_spawn or posix_spawnp.  The first parameter is 'path'.

"The path parameter is the path to the executable file.The path should contain a directory.  Use posix_spawnp() to pass an executable file without directory."

FileNotFoundError and PermissionError are subclasses of OSError.  So is NotADirectoryError.  I was initially tempted to say that either the latter should be added to the tuple or that the tuple should be replaced by OSError.  However, the test failed with posix_spawnp, when the path should not be required to have a directory.  So I wonder if there is a problem with this function on this Debian.  (I do not work with Linux at all.)

Zachary, could you try adding NotADirectoryError to the exception list and see if the test
    self.assertEqual(exc.filename, no_such_executable)
passes?

----------
components: +Library (Lib), Tests -Installation
nosy: +larry, vstinner
stage:  -> test needed
type: compile error -> behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39653>
_______________________________________


More information about the Python-bugs-list mailing list