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

2.6.3: pytest is failing in tests/test_watcher.py::TestWatcher::test_watch_multiple_dirs unit #269

Open
kloczek opened this issue Apr 1, 2023 · 2 comments

Comments

@kloczek
Copy link

kloczek commented Apr 1, 2023

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.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-livereload-2.6.3-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-livereload-2.6.3-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-livereload-2.6.3
collected 5 items

tests/test_watcher.py ....F                                              [100%]

=================================== FAILURES ===================================
_____________________ TestWatcher.test_watch_multiple_dirs _____________________

self = <tests.test_watcher.TestWatcher testMethod=test_watch_multiple_dirs>

    def test_watch_multiple_dirs(self):
        first_dir = os.path.join(tmpdir, 'first')
        second_dir = os.path.join(tmpdir, 'second')

        watcher = Watcher()

        os.mkdir(first_dir)
        watcher.watch(first_dir)
        assert watcher.examine() == (None, None)

        first_path = os.path.join(first_dir, 'foo')
        with open(first_path, 'w') as f:
            f.write('')
        assert watcher.examine() == (first_path, None)
        assert watcher.examine() == (None, None)

        os.mkdir(second_dir)
        watcher.watch(second_dir)
        assert watcher.examine() == (None, None)

        second_path = os.path.join(second_dir, 'bar')
        with open(second_path, 'w') as f:
            f.write('')
        assert watcher.examine() == (second_path, None)
        assert watcher.examine() == (None, None)

        with open(first_path, 'a') as f:
            f.write('foo')
>       assert watcher.examine() == (first_path, None)
E       AssertionError: assert (None, None) == ('/home/tkloc...st/foo', None)
E         At index 0 diff: None != '/home/tkloczko/rpmbuild/BUILD/python-livereload-2.6.3/tests/tmp/first/foo'
E         Use -v to get more diff

tests/test_watcher.py:147: AssertionError
=========================== short test summary info ============================
FAILED tests/test_watcher.py::TestWatcher::test_watch_multiple_dirs - Asserti...
========================= 1 failed, 4 passed in 3.16s ==========================

Here is list of installed modules in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.13
attrs                         22.2.0
Babel                         2.12.1
build                         0.10.0
charset-normalizer            3.1.0
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.0.0
gpg                           1.18.0-unknown
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.1.0
iniconfig                     2.0.0
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.2
packaging                     23.0
pip                           23.0.1
pluggy                        1.0.0
Pygments                      2.14.0
pyproject_hooks               1.0.0
pytest                        7.2.2
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.28.2
rpm                           4.17.0
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.1.3
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2.dev20230202
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20230128
sphinxcontrib-qthelp          1.0.3.dev20230128
sphinxcontrib-serializinghtml 1.1.5
tomli                         2.0.1
tornado                       6.2
urllib3                       1.26.15
wheel                         0.38.4
zipp                          3.15.0
@kloczek
Copy link
Author

kloczek commented Apr 1, 2023

Here is otput only that unit with -v

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-livereload-2.6.3-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-livereload-2.6.3-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' -v tests/test_watcher.py::TestWatcher::test_watch_multiple_dirs
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/tkloczko/rpmbuild/BUILD/python-livereload-2.6.3
collected 1 item

tests/test_watcher.py::TestWatcher::test_watch_multiple_dirs FAILED                                                                                                                   [100%]

========================================================================================= FAILURES ==========================================================================================
___________________________________________________________________________ TestWatcher.test_watch_multiple_dirs ____________________________________________________________________________

self = <tests.test_watcher.TestWatcher testMethod=test_watch_multiple_dirs>

    def test_watch_multiple_dirs(self):
        first_dir = os.path.join(tmpdir, 'first')
        second_dir = os.path.join(tmpdir, 'second')

        watcher = Watcher()

        os.mkdir(first_dir)
        watcher.watch(first_dir)
        assert watcher.examine() == (None, None)

        first_path = os.path.join(first_dir, 'foo')
        with open(first_path, 'w') as f:
            f.write('')
        assert watcher.examine() == (first_path, None)
        assert watcher.examine() == (None, None)

        os.mkdir(second_dir)
        watcher.watch(second_dir)
        assert watcher.examine() == (None, None)

        second_path = os.path.join(second_dir, 'bar')
        with open(second_path, 'w') as f:
            f.write('')
        assert watcher.examine() == (second_path, None)
        assert watcher.examine() == (None, None)

        with open(first_path, 'a') as f:
            f.write('foo')
>       assert watcher.examine() == (first_path, None)
E       AssertionError: assert (None, None) == ('/home/tkloc...st/foo', None)
E         At index 0 diff: None != '/home/tkloczko/rpmbuild/BUILD/python-livereload-2.6.3/tests/tmp/first/foo'
E         Full diff:
E           (
E         -  '/home/tkloczko/rpmbuild/BUILD/python-livereload-2.6.3/tests/tmp/first/foo',
E         +  None,
E            None,
E           )

tests/test_watcher.py:147: AssertionError
================================================================================== short test summary info ==================================================================================
FAILED tests/test_watcher.py::TestWatcher::test_watch_multiple_dirs - AssertionError: assert (None, None) == ('/home/tkloc...st/foo', None)
===================================================================================== 1 failed in 0.21s =====================================================================================

@kloczek
Copy link
Author

kloczek commented Mar 17, 2024

Gentle ping .. any update? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant