Skip to content

Commit a5e64e4

Browse files
committed
Remove flaky test
1 parent 725cf86 commit a5e64e4

File tree

1 file changed

+0
-65
lines changed

1 file changed

+0
-65
lines changed

snooty/test_util.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -99,71 +99,6 @@ def test_add_doc_target_ext() -> None:
9999
assert test_results == resolved_targets
100100

101101

102-
@pytest.mark.skipif(
103-
sys.platform != "darwin" or "GITHUB_RUN_ID" in os.environ,
104-
reason="file watching has very different behavior on different systems; it's hard to test",
105-
)
106-
def test_file_watcher() -> None:
107-
events: List[Tuple[str, str]] = []
108-
109-
def handle(ev: watchdog.events.FileSystemEvent) -> None:
110-
if ev.is_directory:
111-
return
112-
events.append((ev.event_type, ev.src_path))
113-
114-
try:
115-
os.unlink("test_data/__test1")
116-
except FileNotFoundError:
117-
pass
118-
try:
119-
os.unlink("test_data/__test2")
120-
except FileNotFoundError:
121-
pass
122-
123-
try:
124-
with util.FileWatcher(handle) as watcher:
125-
watcher.watch_file(Path("test_data/__test1"))
126-
watcher.watch_file(Path("test_data/__test1"))
127-
watcher.watch_file(Path("test_data/__test1"))
128-
assert len(watcher) == 1
129-
watcher.end_watch(Path("test_data/__test1"))
130-
time.sleep(0.1)
131-
with open("test_data/__test1", "w") as f:
132-
f.write("f")
133-
time.sleep(0.1)
134-
with open("test_data/__test1", "w") as f:
135-
f.write("f")
136-
time.sleep(0.1)
137-
with open("test_data/__test2", "w") as f:
138-
f.write("f")
139-
time.sleep(0.1)
140-
watcher.end_watch(Path("test_data/__test1"))
141-
assert len(watcher) == 1
142-
watcher.end_watch(Path("test_data/__test1"))
143-
assert len(watcher) == 0
144-
watcher.end_watch(Path("test_data/__test1"))
145-
assert len(watcher) == 0
146-
time.sleep(0.1)
147-
with open("test_data/__test1", "w") as f:
148-
f.write("f")
149-
time.sleep(0.1)
150-
151-
assert events == [
152-
("created", "test_data/__test1"),
153-
("modified", "test_data/__test1"),
154-
("modified", "test_data/__test1"),
155-
]
156-
finally:
157-
try:
158-
os.unlink("test_data/__test1")
159-
except FileNotFoundError:
160-
pass
161-
try:
162-
os.unlink("test_data/__test2")
163-
except FileNotFoundError:
164-
pass
165-
166-
167102
def test_make_id() -> None:
168103
assert util.make_html5_id("bin.weird_example-1") == "bin.weird_example-1"
169104
assert util.make_html5_id("a test#") == "a-test-"

0 commit comments

Comments
 (0)