From b9774e9e6e8dcbb7d2e0786eb13ab30848ed1514 Mon Sep 17 00:00:00 2001 From: Kai Knoblich <43905002+knobix@users.noreply.github.com> Date: Sat, 18 Sep 2021 15:05:45 +0200 Subject: [PATCH] Fix test suite on FreeBSD (#842) * Restore previous behavior of "absolute_path()" The function `absolute_path` that was provided by "pathtools" was redefined and now gives a "Path" object back as return value. However, this leads to assertion errors when executing the test suite on FreeBSD, because there are now discrepancies between "PosixPath('/some/dir')" and "'/some/dir'". Thus restore the original return value of "absolute_path" as is was done by "pathtools". See also: https://pythonhosted.org/pathtools/_modules/pathtools/path.html#absolute_path * Skip two checks for BSD * Test "test_delete_self()" was tested only on Darwin platforms with release 0.10.6 * Test "file_lifecyle" was introduced in the 2.0.0 release * Update changelog for (#841) and (#842) --- changelog.rst | 5 +++-- src/watchdog/observers/kqueue.py | 4 +--- tests/test_emitter.py | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changelog.rst b/changelog.rst index ff918c34..057d57db 100644 --- a/changelog.rst +++ b/changelog.rst @@ -8,8 +8,9 @@ Changelog 2021-xx-xx • `full history `__ -- -- Thanks to our beloved contributors: @ +- [bsd] Fixed returned paths in ``kqueue.py`` and restored the overall results of the test suite (`#842 `_) +- [bsd] Updated FreeBSD CI support (`#841 `_) +- Thanks to our beloved contributors: @knobix 2.1.5 ~~~~~ diff --git a/src/watchdog/observers/kqueue.py b/src/watchdog/observers/kqueue.py index bd1f55e1..c70c94f1 100644 --- a/src/watchdog/observers/kqueue.py +++ b/src/watchdog/observers/kqueue.py @@ -76,8 +76,6 @@ import os.path import select -from pathlib import Path - from watchdog.observers.api import ( BaseObserver, EventEmitter, @@ -127,7 +125,7 @@ def absolute_path(path): - return Path(path).resolve() + return os.path.abspath(os.path.normpath(path)) # Flag tests. diff --git a/tests/test_emitter.py b/tests/test_emitter.py index d7e19b36..bec052c8 100644 --- a/tests/test_emitter.py +++ b/tests/test_emitter.py @@ -355,6 +355,7 @@ def test_separate_consecutive_moves(): @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) +@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") def test_delete_self(): mkdir(p('dir1')) start_watching(p('dir1')) @@ -642,6 +643,7 @@ def test_move_nested_subdirectories_on_windows(): @pytest.mark.flaky(max_runs=5, min_passes=1, rerun_filter=rerun_filter) +@pytest.mark.skipif(platform.is_bsd(), reason="BSD create another set of events for this test") def test_file_lifecyle(): start_watching()