question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests fail with python3.8, latest version pulled from master (Linux Mint / Ubuntu)

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolashainauxcommented, Jan 11, 2021

Many thanks for investigating this so quickly and efficiently 👍 Moreover, the warnings are gone, too. I should be able to package a newer version, then.

0reactions
mrbean-bremencommented, Jan 11, 2021

Ok, after updating to Ubuntu 20.04.1 and installing Python 3.8.6 I still cannot reproduce the warnings, so I’m going to ignore them for now, as they also don’t show up in CI. Closing this as fixed - feel free to reopen it if needed. Thanks again for the report!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Solved] yt-dlp just updated and it broke - Linux Mint Forums
It's the python3-brotli module that was missing. ... You can get the latest version (1.0.9) of this python module by doing:
Read more >
Poetry uses wrong Python version · Issue #4101 - GitHub
I am on the latest Poetry version. I have searched the issues of this repo and believe that this is not a duplicate....
Read more >
Python 3 Installation & Setup Guide
In this tutorial you'll learn how to: Check which version of Python, if any, is installed on your machine; Install or update Python...
Read more >
Unable to upgrade Python 3.8.10 to 3.10 - SOLVED
How to upgrade to Python 3.10 on Ubuntu 18.04 and 20.04 LTS - isw blog ... x86_64-linux-gnu-python3.8-config lrwxrwxrwx 1 root root 16 Mar ......
Read more >
ubuntu /usr/bin/env: python: No such file or directory
Problem scenario: /usr/bin/env: 'python': No such file or directory. Possible Solution #1. If Python 3 is not installed, install it: apt-get install python3....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found