Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests.test_observers_winapi.test___init__() fails locally on Python 3.11.2 on Windows 11 #977

Open
altendky opened this issue Mar 18, 2023 · 3 comments

Comments

@altendky
Copy link
Contributor

tests.test_observers_winapi.test___init__() fails locally on Python 3.11.2 on Windows 11.

def test___init__(event_queue, emitter):
emitter.start()
sleep(SLEEP_TIME)
mkdir(p("fromdir"))
sleep(SLEEP_TIME)
mv(p("fromdir"), p("todir"))
sleep(SLEEP_TIME)
emitter.stop()
# What we need here for the tests to pass is a collection type
# that is:
# * unordered
# * non-unique
# A multiset! Python's collections.Counter class seems appropriate.
expected = {
DirCreatedEvent(p("fromdir")),
DirMovedEvent(p("fromdir"), p("todir")),
}
got = set()
while True:
try:
event, _ = event_queue.get_nowait()
except Empty:
break
else:
got.add(event)
assert expected == got

>       assert expected == got
E       AssertionError: assert {<DirMovedEvent: src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', dest_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True>, <DirCreatedEvent: event_type=created, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', is_directory=True} == {<DirMovedEvent: src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', dest_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True>, <DirModifiedEvent: event_type=modified, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True, <DirCreatedEvent: event_type=created, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', is_directory=True}
E         Extra items in the right set:
E         <DirModifiedEvent: event_type=modified, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True
E         Full diff:
E           {
E            <DirCreatedEvent: event_type=created, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', is_directory=True,
E         -  <DirModifiedEvent: event_type=modified, src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True,
E            <DirMovedEvent: src_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\fromdir', dest_path='C:\\Users\\sda\\AppData\\Local\\Temp\\tmpym4vynjz\\Strange ☃\\todir', is_directory=True>,
E           }

I have various tests that consistently fail locally in Linux and Windows. Let's start with this one and see what I learn first.

@altendky
Copy link
Contributor Author

To be more clear @BoboTiG, I'm curious what commentary you have on this. I don't know the history or what to expect in different environments. Like, is this more likely a misdetection or is the move resulting in both the creation and actually a second modification to... force the attributes to match? I dunno.

@BoboTiG
Copy link
Collaborator

BoboTiG commented Mar 19, 2023

What is interesting is that those tests pass on the CI, correct?
Do you are running tests in WSL, maybe?

@altendky
Copy link
Contributor Author

A Windows 11 Pro virtual machine in VirtualBox from a Linux host with a dedicated virtual disk formatted by the Windows installer. And yes, they seem to pass.

https://github.com/gorakhargosh/watchdog/actions/runs/4455642986/jobs/7825573830#step:5:143

tests/test_observers_winapi.py::test___init__ PASSED                     [ 72%]

That's why I'm hoping someone has practical knowledge around why the event would happen locally, albeit in a VM, and not on the server. I guess the filesystem could be entirely different in the GitHub workers, so maybe I ought to figure out how to report that as a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants