Thanks to visit codestin.com
Credit goes to github.com

Skip to content

glob tests miss mypipe #117127

Closed
Closed
@encukou

Description

@encukou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions