Issue 33455: test.test_posix.TestPosixSpawn::test_specify_environment fails with custom LD_LIBRARY_PATH (original) (raw)

When we build Python in Fedora, we set LD_LIBRARY_PATH environment variable so the testsuite is run against the currently built Python.

However a test added in ef347535f289baad22c0601e12a36b2dcd155c3a (test_specify_environment) spawns a process without passing the environment variables. This means that the new process fails with

error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

And the test fails with:

test_specify_environment (test.test_posix.TestPosixSpawn) ... /builddir/build/BUILD/Python-3.7.0b4/build/optimized/python: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory test test_posix failed FAIL

FAIL: test_specify_environment (test.test_posix.TestPosixSpawn)

Traceback (most recent call last): File "/builddir/build/BUILD/Python-3.7.0b4/Lib/test/test_posix.py", line 1467, in test_specify_environment self.assertEqual(os.waitpid(pid, 0), (pid, 0)) AssertionError: Tuples differ: (11457, 32512) != (11457, 0) First differing element 1: 32512 0 - (11457, 32512) ? ^^^^^ + (11457, 0) ? ^

Ran 101 tests in 0.608s FAILED (failures=1, skipped=9) 1 test failed again: test_posix Total duration: 23 min 22 sec Tests result: FAILURE

I believe that a fix for this is to copy os.environ, update it with {'foo': 'bar'} and pass that copy. I'll check and send PR if it works.