Skip to content

Commit 50af6eb

Browse files
oprypinBoboTiG
andauthored
[windows] Fix event detection right after starting an emitter on PyPy (#796)
And re-add PyPy to CI Co-authored-by: Mickaël Schoentgen <[email protected]>
1 parent 4e7ca8d commit 50af6eb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ jobs:
99
name: Run tests for ${{ matrix.os }} for ${{ matrix.python }}
1010
runs-on: ${{ matrix.os }}
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
os: [ubuntu-latest, windows-latest, macos-latest]
14-
python: [3.6, 3.7, 3.8, 3.9]
15+
python: [3.6, 3.7, 3.8, 3.9, pypy3]
1516
steps:
1617
- name: Checkout
1718
uses: actions/checkout@v2

changelog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Changelog
88

99
2021-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v2.1.2...master>`__
1010

11-
-
12-
- Thanks to our beloved contributors: @
11+
- [windows] On PyPy, events happening right after ``start()`` were missed. Add a workaround for that. (`#796 <https://github.com/gorakhargosh/watchdog/pull/796>`_)
12+
- Thanks to our beloved contributors: @oprypin
1313

1414
2.1.1
1515
~~~~~

src/watchdog/observers/read_directory_changes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import threading
2020
import os.path
2121
import time
22+
import platform
2223

2324
from watchdog.events import (
2425
DirCreatedEvent,
@@ -65,6 +66,12 @@ def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
6566
def on_thread_start(self):
6667
self._handle = get_directory_handle(self.watch.path)
6768

69+
if platform.python_implementation() == 'PyPy':
70+
def start(self):
71+
"""PyPy needs some time before receiving events, see #792."""
72+
super().start()
73+
time.sleep(0.01)
74+
6875
def on_thread_stop(self):
6976
if self._handle:
7077
close_directory_handle(self._handle)

0 commit comments

Comments
 (0)