Skip to content

test_renaming_top_level_directory is flaky #1128

@ngoldbaum

Description

@ngoldbaum

See this CI job where I attempted to add Python 3.14 CI. It failed with one failure:

=================================== FAILURES ===================================
______________________ test_renaming_top_level_directory _______________________

p = <bound method Helper.joinpath of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>
event_queue = <queue.Queue object at 0x7f6ff23f8af0>
start_watching = <bound method Helper.start_watching of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>
expect_event = <bound method Helper.expect_event of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>

    @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter)
    @pytest.mark.thread_unsafe(reason="Uses recwarn")
    def test_renaming_top_level_directory(
        p: P,
        event_queue: TestEventQueue,
        start_watching: StartWatching,
        expect_event: ExpectEvent,
    ) -> None:
        start_watching()
    
        mkdir(p("a"))
        expect_event(DirCreatedEvent(p("a")))
        if not platform.is_windows():
            expect_event(DirModifiedEvent(p()))
    
        mkdir(p("a", "b"))
        expect_event(DirCreatedEvent(p("a", "b")))
        expect_event(DirModifiedEvent(p("a")))
    
        mv(p("a"), p("a2"))
>       expect_event(DirMovedEvent(p("a"), p("a2")))

event_queue = <queue.Queue object at 0x7f6ff23f8af0>
expect_event = <bound method Helper.expect_event of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>
p          = <bound method Helper.joinpath of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>
start_watching = <bound method Helper.start_watching of Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)>

tests/test_emitter.py:483: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0', emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>], event_queue=<queue.Queue object at 0x7f6ff23f8af0>)
expected_event = DirMovedEvent(src_path='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0/a', dest_path='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0/a2', event_type='moved', is_directory=True, is_synthetic=False)
timeout = 2

    def expect_event(self, expected_event: FileSystemEvent, timeout: float = 2) -> None:
        """Utility function to wait up to `timeout` seconds for an `event_type` for `path` to show up in the queue.
    
        Provides some robustness for the otherwise flaky nature of asynchronous notifications.
        """
>       assert self.event_queue.get(timeout=timeout)[0] == expected_event
E       AssertionError

expected_event = DirMovedEvent(src_path='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0/a',
              dest_path='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0/a2',
              event_type='moved',
              is_directory=True,
              is_synthetic=False)
self       = Helper(tmp='/tmp/pytest-of-runner/pytest-0/test_renaming_top_level_direct0',
       emitters=[<InotifyEmitter(Thread-39, started daemon 140118763239104)>],
       event_queue=<queue.Queue object at 0x7f6ff23f8af0>)
timeout    = 2

tests/utils.py:89: AssertionError

I'd like to get free-threaded 3.14 support working along with 3.13t but I'm not sure why this test is sensitive to changes in Python 3.14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions