cpython icon indicating copy to clipboard operation
cpython copied to clipboard

glob tests miss `mypipe`

Open encukou opened this issue 3 months ago • 0 comments

On my system, test_glob_named_pipe has been failing since it was added in #116421:

======================================================================
FAIL: test_glob_named_pipe (test.test_glob.GlobTests.test_glob_named_pipe)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/encukou/dev/cpython/Lib/test/test_glob.py", line 354, in test_glob_named_pipe
    self.assertEqual(self.rglob('mypipe*'), [path])
                     ~~~~~~~~~~^^^^^^^^^^^
  File "/home/encukou/dev/cpython/Lib/test/test_glob.py", line 254, in rglob
    return self.glob(*parts, recursive=True, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/encukou/dev/cpython/Lib/test/test_glob.py", line 93, in glob
    self.assertCountEqual(
    ~~~~~~~~~~~~~~~~~~~~~^
        glob.glob(pattern, dir_fd=self.dir_fd, **kwargs), res2)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Element counts were not equal:
First has 0, Second has 1:  'mypipe'

I assume that it's because the self.dir_fd = os.open(self.tempdir) in setUp is done before mkfifo in the test, and the contents at open time show up in directory walk. Indeed, if I change setUp to move some of the mktemps before the open, lots more tests start failing.

I'm on Fedora 39, kernel 6.7.9-200.fc39.x86_64, btrfs.

Linked PRs

  • gh-117128

encukou avatar Mar 21 '24 15:03 encukou