samuelcolvin / watchfiles

Simple, modern and fast file watching and code reload in Python.
https://watchfiles.helpmanual.io
MIT License
1.74k stars 109 forks source link

0.20.0: pytest is failing in 11 units #246

Closed kloczek closed 2 months ago

kloczek commented 1 year ago

Description

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-watchgod-0.20.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-watchgod-0.20.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/watchfiles-0.20.0 configfile: pytest.ini plugins: anyio-3.7.1, mock-3.11.1 collected 161 items tests/test_cli.py ...................F.F. [ 14%] tests/test_docs.py ................s [ 24%] tests/test_filters.py .................. [ 36%] tests/test_force_polling.py .......................... [ 52%] tests/test_run_process.py F.s.....F......FF....... [ 67%] tests/test_rust_notify.py .................................... [ 89%] tests/test_watch.py .....F..FFF.F..s. [100%] ========================================================================================= FAILURES ========================================================================================== _________________________________________________________________________________ test_build_filter_warning _________________________________________________________________________________ caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64ee7730> def test_build_filter_warning(caplog): caplog.set_level('INFO', 'watchfiles') watch_filter, name = build_filter('os.getcwd', 'foo') assert watch_filter is os.getcwd assert name == '' > assert caplog.text == ( 'watchfiles.cli WARNING: "--ignore-paths" argument ignored as filter is not a subclass of DefaultFilter\n' ) E assert 'WARNING wat...faultFilter\n' == 'watchfiles.c...faultFilter\n' E - watchfiles.cli WARNING: "--ignore-paths" argument ignored as filter is not a subclass of DefaultFilter E ? -------- E + WARNING watchfiles.cli:cli.py:218 "--ignore-paths" argument ignored as filter is not a subclass of DefaultFilter E ? +++++++++ ++++++++++ tests/test_cli.py:265: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- WARNING watchfiles.cli:cli.py:218 "--ignore-paths" argument ignored as filter is not a subclass of DefaultFilter _____________________________________________________________________________________ test_args_command _____________________________________________________________________________________ mocker = , tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-25/test_args_command0') caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64e5bd30> def test_args_command(mocker, tmp_path, caplog): caplog.set_level('INFO', 'watchfiles') mocker.patch('watchfiles.cli.sys.stdin.fileno') mocker.patch('os.ttyname', return_value='/path/to/tty') mock_run_process = mocker.patch('watchfiles.cli.run_process') cli('--args', '--version ', 'foobar.sh', str(tmp_path)) mock_run_process.assert_called_once_with( tmp_path, target='foobar.sh', target_type='command', watch_filter=IsInstance(DefaultFilter, only_direct_instance=True), debug=False, grace_period=0, sigint_timeout=5, sigkill_timeout=1, recursive=True, ignore_permission_denied=False, ) > assert 'WARNING: --args is only used when the target is a function\n' in caplog.text E assert 'WARNING: --args is only used when the target is a function\n' in 'WARNING watchfiles.cli:cli.py:152 --args is only used when the target is a function\nINFO watchfiles.cli:cli.py:... 👀 path="/tmp/pytest-of-tkloczko/pytest-25/test_args_command0" target="foobar.sh" (command) filter=DefaultFilter...\n' E + where 'WARNING watchfiles.cli:cli.py:152 --args is only used when the target is a function\nINFO watchfiles.cli:cli.py:... 👀 path="/tmp/pytest-of-tkloczko/pytest-25/test_args_command0" target="foobar.sh" (command) filter=DefaultFilter...\n' = <_pytest.logging.LogCaptureFixture object at 0x7f4c64e5bd30>.text tests/test_cli.py:312: AssertionError ----------------------------------------------------------------------------------- Captured stderr call ------------------------------------------------------------------------------------ [19:10:37] --args is only used when the target is a function [19:10:37] watchfiles v0.0.0 👀 path="/tmp/pytest-of-tkloczko/pytest-25/test_args_command0" target="foobar.sh" (command) filter=DefaultFilter... ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- WARNING watchfiles.cli:cli.py:152 --args is only used when the target is a function INFO watchfiles.cli:cli.py:162 watchfiles v0.0.0 👀 path="/tmp/pytest-of-tkloczko/pytest-25/test_args_command0" target="foobar.sh" (command) filter=DefaultFilter... ___________________________________________________________________________________ test_alive_terminates ___________________________________________________________________________________ mocker = , mock_rust_notify = .mock at 0x7f4c64af6ca0> caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64f1a370> def test_alive_terminates(mocker, mock_rust_notify: 'MockRustType', caplog): caplog.set_level('DEBUG', 'watchfiles') mock_spawn_process = mocker.patch('watchfiles.run.spawn_context.Process', return_value=FakeProcess()) mock_popen = mocker.patch('watchfiles.run.subprocess.Popen', return_value=FakePopen()) mock_kill = mocker.patch('watchfiles.run.os.kill') mock_rust_notify([{(1, '/path/to/foobar.py')}]) assert run_process('/x/y/z', target=os.getcwd, debounce=5, grace_period=0.01, step=1) == 1 assert mock_spawn_process.call_count == 2 assert mock_popen.call_count == 0 assert mock_kill.call_count == 2 # kill in loop + final kill > assert 'watchfiles.main DEBUG: running "" as function\n' in caplog.text E assert 'watchfiles.main DEBUG: running "" as function\n' in 'DEBUG watchfiles.main:run.py:131 running "" as function\nDEBUG watchfiles.main:run.py...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' E + where 'DEBUG watchfiles.main:run.py:131 running "" as function\nDEBUG watchfiles.main:run.py...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' = <_pytest.logging.LogCaptureFixture object at 0x7f4c64f1a370>.text tests/test_run_process.py:54: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:run.py:131 running "" as function DEBUG watchfiles.main:run.py:440 registering handler for SIGTERM on watchfiles process 1609152 DEBUG watchfiles.main:run.py:137 sleeping for 0.01 seconds before watching for changes DEBUG watchfiles.main:main.py:295 1 change detected: {(, '/path/to/foobar.py')} DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped _______________________________________________________________________________ test_function_string_not_win ________________________________________________________________________________ mocker = , mock_rust_notify = .mock at 0x7f4c64af6af0> caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64cfc070> def test_function_string_not_win(mocker, mock_rust_notify: 'MockRustType', caplog): caplog.set_level('DEBUG', 'watchfiles') mock_spawn_process = mocker.patch('watchfiles.run.spawn_context.Process', return_value=FakeProcess()) mocker.patch('watchfiles.run.os.kill') mock_rust_notify([{(1, '/path/to/foobar.py')}]) assert run_process('/x/y/z', target='os.getcwd', debounce=5, step=1) == 1 assert mock_spawn_process.call_count == 2 # get_tty_path returns None on windows tty_path = None if sys.platform == 'win32' else IsStr(regex='/dev/.+') mock_spawn_process.assert_called_with(target=run_function, args=('os.getcwd', tty_path, (), {}), kwargs={}) > assert 'watchfiles.main DEBUG: running "os.getcwd" as function\n' in caplog.text E assert 'watchfiles.main DEBUG: running "os.getcwd" as function\n' in 'DEBUG watchfiles.main:run.py:131 running "os.getcwd" as function\nDEBUG watchfiles.main:run.py:440 registering ...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' E + where 'DEBUG watchfiles.main:run.py:131 running "os.getcwd" as function\nDEBUG watchfiles.main:run.py:440 registering ...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' = <_pytest.logging.LogCaptureFixture object at 0x7f4c64cfc070>.text tests/test_run_process.py:148: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:run.py:131 running "os.getcwd" as function DEBUG watchfiles.main:run.py:440 registering handler for SIGTERM on watchfiles process 1609152 DEBUG watchfiles.main:main.py:295 1 change detected: {(, '/path/to/foobar.py')} DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped _______________________________________________________________________________________ test_command ________________________________________________________________________________________ mocker = , mock_rust_notify = .mock at 0x7f4c64cfe790> caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64f21280> def test_command(mocker, mock_rust_notify: 'MockRustType', caplog): caplog.set_level('DEBUG', 'watchfiles') mock_spawn_process = mocker.patch('watchfiles.run.spawn_context.Process', return_value=FakeProcess()) mock_popen = mocker.patch('watchfiles.run.subprocess.Popen', return_value=FakePopen()) mock_kill = mocker.patch('watchfiles.run.os.kill') mock_rust_notify([{(1, '/path/to/foobar.py')}]) assert run_process('/x/y/z', target='echo foobar', debounce=5, step=1) == 1 assert mock_spawn_process.call_count == 0 assert mock_popen.call_count == 2 mock_popen.assert_called_with(['echo', 'foobar']) assert mock_kill.call_count == 2 # kill in loop + final kill > assert 'watchfiles.main DEBUG: running "echo foobar" as command\n' in caplog.text E assert 'watchfiles.main DEBUG: running "echo foobar" as command\n' in 'DEBUG watchfiles.main:run.py:131 running "echo foobar" as command\nDEBUG watchfiles.main:run.py:440 registering...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' E + where 'DEBUG watchfiles.main:run.py:131 running "echo foobar" as command\nDEBUG watchfiles.main:run.py:440 registering...topped\nDEBUG watchfiles.main:run.py:328 stopping process...\nDEBUG watchfiles.main:run.py:345 process stopped\n' = <_pytest.logging.LogCaptureFixture object at 0x7f4c64f21280>.text tests/test_run_process.py:242: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:run.py:131 running "echo foobar" as command DEBUG watchfiles.main:run.py:440 registering handler for SIGTERM on watchfiles process 1609152 DEBUG watchfiles.main:main.py:295 1 change detected: {(, '/path/to/foobar.py')} DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped DEBUG watchfiles.main:run.py:328 stopping process... DEBUG watchfiles.main:run.py:345 process stopped __________________________________________________________________________________ test_command_with_args ___________________________________________________________________________________ mocker = , mock_rust_notify = .mock at 0x7f4c64cfed30> caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64fd51f0> def test_command_with_args(mocker, mock_rust_notify: 'MockRustType', caplog): caplog.set_level('INFO', 'watchfiles') mock_spawn_process = mocker.patch('watchfiles.run.spawn_context.Process', return_value=FakeProcess()) mock_popen = mocker.patch('watchfiles.run.subprocess.Popen', return_value=FakePopen()) mock_kill = mocker.patch('watchfiles.run.os.kill') mock_rust_notify([{(1, '/path/to/foobar.py')}]) assert run_process('/x/y/z', target='echo foobar', args=(1, 2), target_type='command', debounce=5, step=1) == 1 assert mock_spawn_process.call_count == 0 assert mock_popen.call_count == 2 mock_popen.assert_called_with(['echo', 'foobar']) assert mock_kill.call_count == 2 # kill in loop + final kill > assert 'watchfiles.main WARNING: ignoring args and kwargs for "command" target\n' in caplog.text E assert 'watchfiles.main WARNING: ignoring args and kwargs for "command" target\n' in 'WARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target\nINFO watchfiles.main:main.py:297 1 change detected\nWARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target\n' E + where 'WARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target\nINFO watchfiles.main:main.py:297 1 change detected\nWARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target\n' = <_pytest.logging.LogCaptureFixture object at 0x7f4c64fd51f0>.text tests/test_run_process.py:257: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- WARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target INFO watchfiles.main:main.py:297 1 change detected WARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target ______________________________________________________________________________ test_watch_dont_raise_interrupt ______________________________________________________________________________ mock_rust_notify = .mock at 0x7f4c64e099d0>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64e64850> def test_watch_dont_raise_interrupt(mock_rust_notify: 'MockRustType', caplog): caplog.set_level('WARNING', 'watchfiles') mock_rust_notify([{(1, 'foo.txt')}], exit_code='signal') w = watch('.', raise_interrupt=False) assert next(w) == {(Change.added, 'foo.txt')} with pytest.raises(StopIteration): next(w) > assert caplog.text == 'watchfiles.main WARNING: KeyboardInterrupt caught, stopping watch\n' E AssertionError: assert 'WARNING wat...pping watch\n' == 'watchfiles.m...pping watch\n' E - watchfiles.main WARNING: KeyboardInterrupt caught, stopping watch E ? -------- E + WARNING watchfiles.main:main.py:132 KeyboardInterrupt caught, stopping watch E ? +++++++++ +++++++++++ tests/test_watch.py:74: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- WARNING watchfiles.main:main.py:132 KeyboardInterrupt caught, stopping watch ____________________________________________________________________________________ test_watch_no_yield ____________________________________________________________________________________ mock_rust_notify = .mock at 0x7f4c64e091f0>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64cdbd90> def test_watch_no_yield(mock_rust_notify: 'MockRustType', caplog): mock = mock_rust_notify([{(1, 'spam.pyc')}, {(1, 'spam.py'), (2, 'ham.txt')}]) caplog.set_level('INFO', 'watchfiles') assert next(watch('.')) == {(Change.added, 'spam.py'), (Change.modified, 'ham.txt')} assert mock.watch_count == 2 > assert caplog.text == 'watchfiles.main INFO: 2 changes detected\n' E AssertionError: assert 'INFO wat...es detected\n' == 'watchfiles.m...es detected\n' E - watchfiles.main INFO: 2 changes detected E + INFO watchfiles.main:main.py:297 2 changes detected tests/test_watch.py:113: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- INFO watchfiles.main:main.py:297 2 changes detected ___________________________________________________________________________________ test_awatch_no_yield ____________________________________________________________________________________ mock_rust_notify = .mock at 0x7f4c64e09430>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64edb6a0> async def test_awatch_no_yield(mock_rust_notify: 'MockRustType', caplog): mock = mock_rust_notify([{(1, 'spam.pyc')}, {(1, 'spam.py')}]) caplog.set_level('DEBUG', 'watchfiles') changes = None async for changes in awatch('.'): pass assert changes == {(Change.added, 'spam.py')} assert mock.watch_count == 2 > assert caplog.text == ( "watchfiles.main DEBUG: all changes filtered out, raw_changes={(1, 'spam.pyc')}\n" "watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')}\n" ) E assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" E - watchfiles.main DEBUG: all changes filtered out, raw_changes={(1, 'spam.pyc')} E ? ------ E + DEBUG watchfiles.main:main.py:277 all changes filtered out, raw_changes={(1, 'spam.pyc')} E ? +++++++++ +++++++++++ E - watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')} E ? ------ E + DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} E ? +++++++++ +++++++++++ tests/test_watch.py:126: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:main.py:277 all changes filtered out, raw_changes={(1, 'spam.pyc')} DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} ____________________________________________________________________________________ test_watch_timeout _____________________________________________________________________________________ mock_rust_notify = .mock at 0x7f4c64e4caf0>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64ffe5e0> def test_watch_timeout(mock_rust_notify: 'MockRustType', caplog): mock = mock_rust_notify(['timeout', {(1, 'spam.py')}]) caplog.set_level('DEBUG', 'watchfiles') change_list = [] for changes in watch('.'): change_list.append(changes) assert change_list == [{(Change.added, 'spam.py')}] assert mock.watch_count == 2 > assert caplog.text == ( "watchfiles.main DEBUG: rust notify timeout, continuing\n" # noqa: Q000 "watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')}\n" ) E assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" E - watchfiles.main DEBUG: rust notify timeout, continuing E ? ------ E + DEBUG watchfiles.main:main.py:127 rust notify timeout, continuing E ? +++++++++ +++++++++++ E - watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')} E ? ------ E + DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} E ? +++++++++ +++++++++++ tests/test_watch.py:142: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:main.py:127 rust notify timeout, continuing DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} ____________________________________________________________________________________ test_awatch_timeout ____________________________________________________________________________________ mock_rust_notify = .mock at 0x7f4c64f429d0>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f4c64ce7400> async def test_awatch_timeout(mock_rust_notify: 'MockRustType', caplog): mock = mock_rust_notify(['timeout', {(1, 'spam.py')}]) caplog.set_level('DEBUG', 'watchfiles') change_list = [] async for changes in awatch('.'): change_list.append(changes) assert change_list == [{(Change.added, 'spam.py')}] assert mock.watch_count == 2 > assert caplog.text == ( "watchfiles.main DEBUG: rust notify timeout, continuing\n" # noqa: Q000 "watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')}\n" ) E assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" E - watchfiles.main DEBUG: rust notify timeout, continuing E ? ------ E + DEBUG watchfiles.main:main.py:265 rust notify timeout, continuing E ? +++++++++ +++++++++++ E - watchfiles.main DEBUG: 1 change detected: {(, 'spam.py')} E ? ------ E + DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} E ? +++++++++ +++++++++++ tests/test_watch.py:169: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG watchfiles.main:main.py:265 rust notify timeout, continuing DEBUG watchfiles.main:main.py:295 1 change detected: {(, 'spam.py')} ===================================================================================== warnings summary ====================================================================================== ../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1373 /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1373: PytestConfigWarning: Unknown config option: asyncio_mode self._warn_or_fail_if_strict(f"Unknown config option: {key}\n") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/test_docs.py:105: output varies between versions SKIPPED [1] tests/test_run_process.py:72: no need to test this except on windows SKIPPED [1] tests/test_watch.py:192: different on windows FAILED tests/test_cli.py::test_build_filter_warning - assert 'WARNING wat...faultFilter\n' == 'watchfiles.c...faultFilter\n' FAILED tests/test_cli.py::test_args_command - assert 'WARNING: --args is only used when the target is a function\n' in 'WARNING watchfiles.cli:cli.py:152 --args is only used when the target is a function\nINFO watchfiles.cli:... FAILED tests/test_run_process.py::test_alive_terminates - assert 'watchfiles.main DEBUG: running "" as function\n' in 'DEBUG watchfiles.main:run.py:131 running "" as function\nDEBUG wa... FAILED tests/test_run_process.py::test_function_string_not_win - assert 'watchfiles.main DEBUG: running "os.getcwd" as function\n' in 'DEBUG watchfiles.main:run.py:131 running "os.getcwd" as function\nDEBUG watchfiles.main:run.py:440 registeri... FAILED tests/test_run_process.py::test_command - assert 'watchfiles.main DEBUG: running "echo foobar" as command\n' in 'DEBUG watchfiles.main:run.py:131 running "echo foobar" as command\nDEBUG watchfiles.main:run.py:440 registe... FAILED tests/test_run_process.py::test_command_with_args - assert 'watchfiles.main WARNING: ignoring args and kwargs for "command" target\n' in 'WARNING watchfiles.main:run.py:280 ignoring args and kwargs for "command" target\nINFO watchf... FAILED tests/test_watch.py::test_watch_dont_raise_interrupt - AssertionError: assert 'WARNING wat...pping watch\n' == 'watchfiles.m...pping watch\n' FAILED tests/test_watch.py::test_watch_no_yield - AssertionError: assert 'INFO wat...es detected\n' == 'watchfiles.m...es detected\n' FAILED tests/test_watch.py::test_awatch_no_yield - assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" FAILED tests/test_watch.py::test_watch_timeout - assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" FAILED tests/test_watch.py::test_awatch_timeout - assert "DEBUG wat...'spam.py')}\n" == "watchfiles.m...'spam.py')}\n" =================================================================== 11 failed, 147 passed, 3 skipped, 1 warning in 3.85s ==================================================================== ```

Here is list of installed modules in build env

```console Package Version ---------------------------------------- ---------- alabaster 0.7.13 anyio 3.7.1 async-timeout 4.0.3 Babel 2.12.1 build 1.0.3 charset-normalizer 3.2.0 click 8.1.7 dirty-equals 0.7.0 distro 1.8.0 docutils 0.20.1 dunamai 1.18.0 exceptiongroup 1.1.3 gpg 1.21.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 libcomps 0.1.19 Mako 1.2.4.dev0 Markdown 3.4.4 MarkupSafe 2.1.3 maturin 1.2.3 packaging 23.1 pkg 0.0.0 pluggy 1.3.0 poetry-core 1.7.0 poetry-dynamic-versioning 1.0.1 poetry-plugin-tweak-dependencies-version 0.1.0 psutil 5.9.5 Pygments 2.16.1 PyGObject 3.44.1 pyproject_hooks 1.0.0 pytest 7.4.2 pytest-mock 3.11.1 python-dateutil 2.8.2 pytz 2023.3 redis 5.0.0 requests 2.31.0 setuptools 68.2.2 six 1.16.0 smartypants 2.0.1 sniffio 1.3.0 snowballstemmer 2.2.0 Sphinx 7.0.1 sphinx-rtd-theme 1.2.2 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.3 sphinxcontrib-jquery 4.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 toml 0.10.2 tomli 2.0.1 tomlkit 0.12.1 typogrify 2.0.7 urllib3 1.26.16 wheel 0.41.1 zipp 3.16.2 ```

Example Code

N/A

Watchfiles Output

N/A

Operating System & Architecture

$ python3 -c 'import platform; print(platform.platform()); print(platform.version())'
Linux-6.4.8-200.fc38.x86_64-x86_64-with-glibc2.34
#1 SMP PREEMPT_DYNAMIC Thu Aug  3 21:44:06 UTC 2023

Environment

No response

Python & Watchfiles Version

This issue is not about installed watchfiles

Rust & Cargo Version

cargo 1.72.0 rustc 1.72.0 (5680fa18f 2023-08-23) (Fedora 1.72.0-1.fc40)

samuelcolvin commented 1 year ago

Looks like just some logging paths differ. PR welcome to use regexes to avoid these failures.

kloczek commented 1 year ago

To form PR it is necessary to know the code .. which I don't know.

kloczek commented 11 months ago

I just tested 0.21.0 and looks like now fails only one unit

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-watchfiles-0.21.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-watchfiles-0.21.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib ============================= test session starts ============================== platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/watchfiles-0.21.0 configfile: pyproject.toml testpaths: tests plugins: anyio-4.0.0, mock-3.12.0, timeout-2.2.0 timeout: 10.0s timeout method: signal timeout func_only: False collected 161 items tests/test_cli.py ....................... [ 14%] tests/test_docs.py ................s [ 24%] tests/test_filters.py .................. [ 36%] tests/test_force_polling.py .......................... [ 52%] tests/test_run_process.py ..s..................... [ 67%] tests/test_rust_notify.py .................................... [ 89%] tests/test_watch.py ...............sF [100%] =================================== FAILURES =================================== _________________________ test_awatch_interrupt_raise __________________________ self = args = (1600, 50, 5000, ) def watch(self, *args): if self.i == 1: > raise KeyboardInterrupt('test error') E KeyboardInterrupt: test error tests/test_watch.py:204: KeyboardInterrupt During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILDROOT/python-watchfiles-0.21.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/watchfiles/main.py", line 254, in awatch raw_changes = await anyio.to_thread.run_sync(watcher.watch, debounce, step, timeout, stop_event_) File "/usr/lib/python3.8/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2106, in run_sync_in_worker_thread return await future File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 833, in run result = context.run(func, *args) File "/home/tkloczko/rpmbuild/BUILD/watchfiles-0.21.0/tests/test_watch.py", line 204, in watch raise KeyboardInterrupt('test error') KeyboardInterrupt: test error During handling of the above exception, another exception occurred: + Exception Group Traceback (most recent call last): | File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 341, in from_call | result: Optional[TResult] = func() | File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 262, in | lambda: ihook(item=item, **kwds), when=when, reraise=reraise | File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 493, in __call__ | return self._hookexec(self.name, self._hookimpls, kwargs, firstresult) | File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 115, in _hookexec | return self._inner_hookexec(hook_name, methods, kwargs, firstresult) | File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 152, in _multicall | return outcome.get_result() | File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 114, in get_result | raise exc.with_traceback(exc.__traceback__) | File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 77, in _multicall | res = hook_impl.function(*args) | File "/usr/lib/python3.8/site-packages/_pytest/runner.py", line 169, in pytest_runtest_call | item.runtest() | File "/usr/lib/python3.8/site-packages/_pytest/python.py", line 1797, in runtest | self.ihook.pytest_pyfunc_call(pyfuncitem=self) | File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 493, in __call__ | return self._hookexec(self.name, self._hookimpls, kwargs, firstresult) | File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 115, in _hookexec | return self._inner_hookexec(hook_name, methods, kwargs, firstresult) | File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 113, in _multicall | raise exception.with_traceback(exception.__traceback__) | File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 77, in _multicall | res = hook_impl.function(*args) | File "/usr/lib/python3.8/site-packages/anyio/pytest_plugin.py", line 119, in pytest_pyfunc_call | runner.run_test(pyfuncitem.obj, testargs) | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 1936, in run_test | self.get_loop().run_until_complete( | File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete | return future.result() | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 1896, in _call_in_runner_task | return await future | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 1874, in _run_tests_and_fixtures | retval = await coro | File "/home/tkloczko/rpmbuild/BUILD/watchfiles-0.21.0/tests/test_watch.py", line 224, in test_awatch_interrupt_raise | async for _ in awatch('.', stop_event=stop_event): | File "/home/tkloczko/rpmbuild/BUILDROOT/python-watchfiles-0.21.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/watchfiles/main.py", line 259, in awatch | tg.cancel_scope.cancel() | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 664, in __aexit__ | raise BaseExceptionGroup( | exceptiongroup.BaseExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/home/tkloczko/rpmbuild/BUILDROOT/python-watchfiles-0.21.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages/watchfiles/main.py", line 254, in awatch | raw_changes = await anyio.to_thread.run_sync(watcher.watch, debounce, step, timeout, stop_event_) | File "/usr/lib/python3.8/site-packages/anyio/to_thread.py", line 33, in run_sync | return await get_async_backend().run_sync_in_worker_thread( | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 2106, in run_sync_in_worker_thread | return await future | File "/usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 833, in run | result = context.run(func, *args) | File "/home/tkloczko/rpmbuild/BUILD/watchfiles-0.21.0/tests/test_watch.py", line 204, in watch | raise KeyboardInterrupt('test error') | KeyboardInterrupt: test error +------------------------------------ ------------------------------ Captured log call ------------------------------- watchfiles.main INFO: 1 change detected =========================== short test summary info ============================ SKIPPED [1] tests/test_docs.py:105: output varies between versions SKIPPED [1] tests/test_run_process.py:72: no need to test this except on windows SKIPPED [1] tests/test_watch.py:192: different on windows FAILED tests/test_watch.py::test_awatch_interrupt_raise - exceptiongroup.Base... =================== 1 failed, 157 passed, 3 skipped in 3.66s =================== ```
samuelcolvin commented 2 months ago

closed as we've released v0.22 and v0.23.