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

Adapt tests to improve BSD support. #633

Merged
merged 2 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Changelog
- Fixed the ``build_ext`` command on macOS Catalina (`#628 <https://github.com/gorakhargosh/watchdog/pull/628>`__)
- Refactored ``dispatch()`` method of ``FileSystemEventHandler``,
``PatternMatchingEventHandler`` and ``RegexMatchingEventHandler``
- Thanks to our beloved contributors: @BoboTiG
- Improve tests support on non Windows/Linux platforms (`#633 <https://github.com/gorakhargosh/watchdog/pull/633>`__)
- Thanks to our beloved contributors: @BoboTiG, @evilham


0.10.1
Expand Down
16 changes: 10 additions & 6 deletions tests/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
from watchdog.observers.read_directory_changes import (
WindowsApiEmitter as Emitter
)
elif platform.is_bsd():
from watchdog.observers.kqueue import (
KqueueEmitter as Emitter
)

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -177,7 +181,7 @@ def test_move_to():
assert isinstance(event, DirModifiedEvent)


@pytest.mark.skipif(platform.is_windows(), reason="InotifyFullEmitter not supported by Windows")
@pytest.mark.skipif(not platform.is_linux(), reason="InotifyFullEmitter only supported in Linux")
def test_move_to_full():
mkdir(p('dir1'))
mkdir(p('dir2'))
Expand Down Expand Up @@ -209,7 +213,7 @@ def test_move_from():
assert isinstance(event, DirModifiedEvent)


@pytest.mark.skipif(platform.is_windows(), reason="InotifyFullEmitter not supported by Windows")
@pytest.mark.skipif(not platform.is_linux(), reason="InotifyFullEmitter only supported in Linux")
def test_move_from_full():
mkdir(p('dir1'))
mkdir(p('dir2'))
Expand Down Expand Up @@ -398,8 +402,8 @@ def test_renaming_top_level_directory():


@pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter)
@pytest.mark.skipif(platform.is_linux(),
reason="Linux create another set of events for this test")
@pytest.mark.skipif(not platform.is_windows(),
reason="Non-Windows create another set of events for this test")
def test_renaming_top_level_directory_on_windows():
start_watching()

Expand Down Expand Up @@ -485,8 +489,8 @@ def test_move_nested_subdirectories():


@pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter)
@pytest.mark.skipif(platform.is_linux(),
reason="Linux create another set of events for this test")
@pytest.mark.skipif(not platform.is_windows(),
reason="Non-Windows create another set of events for this test")
def test_move_nested_subdirectories_on_windows():
mkdir(p('dir1/dir2/dir3'), parents=True)
touch(p('dir1/dir2/dir3', 'a'))
Expand Down