Skip to content

Commit

Permalink
Fix test suite on FreeBSD (#842)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
knobix committed Sep 18, 2021
1 parent d444b4a commit b9774e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions changelog.rst
Expand Up @@ -8,8 +8,9 @@ Changelog

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

-
- Thanks to our beloved contributors: @
- [bsd] Fixed returned paths in ``kqueue.py`` and restored the overall results of the test suite (`#842 <https://github.com/gorakhargosh/watchdog/pull/842>`_)
- [bsd] Updated FreeBSD CI support (`#841 <https://github.com/gorakhargosh/watchdog/pull/841>`_)
- Thanks to our beloved contributors: @knobix

2.1.5
~~~~~
Expand Down
4 changes: 1 addition & 3 deletions src/watchdog/observers/kqueue.py
Expand Up @@ -76,8 +76,6 @@
import os.path
import select

from pathlib import Path

from watchdog.observers.api import (
BaseObserver,
EventEmitter,
Expand Down Expand Up @@ -127,7 +125,7 @@


def absolute_path(path):
return Path(path).resolve()
return os.path.abspath(os.path.normpath(path))

# Flag tests.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_emitter.py
Expand Up @@ -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'))
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit b9774e9

Please sign in to comment.