Closed
Description
Hello,
Trying to update the (unofficial) Ubuntu 20.04 package on my PPA to a newer version, I got an error in the tests.
I reproduced it at home (Linux Mint), just running python3.8 -m pytest
:
(NB I tried also with the 4.3.3 release (pointing git's HEAD to 3bc6f0c Release 4.3.3) and got the exact same output)
$ python3.8 -m pytest
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-4.6.9, py-1.9.0, pluggy-0.13.1
rootdir: /home/nico/.local/dev/pyfakefs
plugins: cov-2.8.1, mock-1.10.4, pyfakefs-4.2.dev0
collected 2024 items
pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py s [ 0%]
pyfakefs/pytest_tests/pytest_fixture_param_test.py x.. [ 0%]
pyfakefs/pytest_tests/pytest_fixture_test.py x.. [ 0%]
pyfakefs/pytest_tests/pytest_plugin_test.py ... [ 0%]
pyfakefs/tests/dynamic_patch_test.py ..... [ 0%]
pyfakefs/tests/example_test.py .......s [ 1%]
pyfakefs/tests/fake_filesystem_glob_test.py ......... [ 1%]
pyfakefs/tests/fake_filesystem_shutil_test.py ...............s...sssssss [ 2%]
ssssssssssssss...........sssssssssss [ 4%]
pyfakefs/tests/fake_filesystem_test.py ................................. [ 6%]
........................................................................ [ 9%]
................................................................s....... [ 13%]
...................................................................... [ 16%]
pyfakefs/tests/fake_filesystem_unittest_test.py ........................ [ 18%]
.x...............................x.......................... [ 20%]
pyfakefs/tests/fake_filesystem_vs_real_test.py ......................... [ 22%]
.. [ 22%]
pyfakefs/tests/fake_open_test.py ....................................... [ 24%]
................................ssssssssssssssssssssssssssssssssssssssss [ 27%]
sssssssssssssssssssssssssssssss...sss..sss............ssssssssssss...... [ 31%]
....ssssssssss.......sssssss.....sssss.....sss..ss.....sssss............ [ 34%]
......ssssssssssssssssss [ 36%]
pyfakefs/tests/fake_os_test.py ......................................... [ 38%]
........................................................................ [ 41%]
...........................F............................................ [ 45%]
........................................................................ [ 48%]
....................ssssssssssssssssssssssssssssssssssssssssssssssssssss [ 52%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 55%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 59%]
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 63%]
sssssssss............................................................... [ 66%]
....................ssssssssssssssssssssssssssssssssssssssssssssssssssss [ 70%]
sssssssssssssssssssssssssssssss...................s..................... [ 73%]
..............s......sssssssssssssssssssssssssssssssssssssssssssssssss.. [ 77%]
.........sssssssssss......................................ssssssssssssss [ 80%]
............ssssssssssssss............ssssssssssssss............ssssssss [ 84%]
ssssss.......sss [ 85%]
pyfakefs/tests/fake_pathlib_test.py ....s.ssssssssssssss.s......ssssssss [ 86%]
...........s.sss...sssssssssssssssssss...s.....s..............ssssssssss [ 90%]
ssssssssssssss.....................................sssssssssssssssssssss [ 94%]
ssssssssssssssss..... [ 95%]
pyfakefs/tests/fake_stat_time_test.py .......sssssss........ssssssss.... [ 96%]
...sssssss........ssssssss.....sssss......ssssss [ 99%]
pyfakefs/tests/fake_tempfile_test.py ........ [ 99%]
pyfakefs/tests/mox3_stubout_test.py ......... [100%]
=================================== FAILURES ===================================
___________________ FakeOsModuleTest.test_open_existing_pipe ___________________
self = <pyfakefs.tests.fake_os_test.FakeOsModuleTest testMethod=test_open_existing_pipe>
def test_open_existing_pipe(self):
if self.is_pypy:
raise unittest.SkipTest('Does not work correctly with PyPy')
read_fd, write_fd = self.os.pipe()
with self.open(write_fd, 'wb') as f:
> self.assertEqual(4, f.write(b'test'))
pyfakefs/tests/fake_os_test.py:2709:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyfakefs.fake_filesystem.FakePipeWrapper object at 0x7fe042b61d30>
contents = b'test'
def write(self, contents):
"""Write to the real pipe."""
> return os.write(self.fd, contents)
E OSError: [Errno 9] Bad file descriptor
pyfakefs/fake_filesystem.py:5156: OSError
======== 1 failed, 1212 passed, 807 skipped, 4 xfailed in 6.16 seconds =========
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pytest.py", line 102, in <module>
raise SystemExit(pytest.main())
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 82, in main
return config.hook.pytest_cmdline_main(config=config)
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "/home/nico/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 243, in pytest_cmdline_main
return wrap_session(config, _main)
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 238, in wrap_session
config._ensure_unconfigure()
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 732, in _ensure_unconfigure
fin()
File "/usr/lib/python3/dist-packages/_pytest/capture.py", line 127, in stop_global_capturing
self._global_capturing.stop_capturing()
File "/usr/lib/python3/dist-packages/_pytest/capture.py", line 532, in stop_capturing
self.in_.done()
File "/usr/lib/python3/dist-packages/_pytest/capture.py", line 611, in done
_attempt_to_close_capture_file(self.tmpfile)
File "/usr/lib/python3/dist-packages/_pytest/capture.py", line 850, in _attempt_to_close_capture_file
f.close()
OSError: [Errno 9] Bad file descriptor
Environment details
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0]
pyfakefs 4.4dev