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.1: pytest is failing in repoze/tm/tests.py::TestMakeTM::test_make_tm_withveto unit #8

Open
kloczek opened this issue Dec 30, 2021 · 3 comments

Comments

@kloczek
Copy link

kloczek commented Dec 30, 2021

I'm trying to package 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
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-7.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-7.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib repoze/tm/tests.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/repoze.tm2-2.1
plugins: mock-3.6.1, httpbin-1.0.0
collected 26 items

repoze/tm/tests.py ................F.........                                                                                                                        [100%]

================================================================================= FAILURES =================================================================================
_____________________________________________________________________ TestMakeTM.test_make_tm_withveto _____________________________________________________________________

self = <tests.TestMakeTM testMethod=test_make_tm_withveto>

    def test_make_tm_withveto(self):
        from repoze.tm import make_tm
        tm = make_tm(DummyApplication(), {}, 'repoze.tm.tests:fakeveto')
>       self.assertEqual(tm.commit_veto, fakeveto)
E       AssertionError: <function fakeveto at 0x7fe25c361f70> != <function fakeveto at 0x7fe25c669940>

repoze/tm/tests.py:194: AssertionError
============================================================================= warnings summary =============================================================================
repoze/tm/tests.py::TestMakeTM::test_make_tm_withveto
  /home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-7.fc35.x86_64/usr/lib/python3.8/site-packages/repoze/tm/__init__.py:177: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
    commit_veto = EntryPoint.parse('x=%s' % commit_veto).load(False)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED repoze/tm/tests.py::TestMakeTM::test_make_tm_withveto - AssertionError: <function fakeveto at 0x7fe25c361f70> != <function fakeveto at 0x7fe25c669940>
================================================================= 1 failed, 25 passed, 1 warning in 0.47s ==================================================================
@tseaver
Copy link
Member

tseaver commented Jan 21, 2022

Hmm, I have a PR (#10) which converts tox.ini to use py.test -- it doesn't reproduce this error.

@kloczek
Copy link
Author

kloczek commented Apr 22, 2022

Just tested that PR with all master commits and pytest executed without any paraameters cannot find units.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/repoze.tm2-2.1
plugins: mock-3.7.0
collected 0 items

========================================================================== no tests ran in 0.02s ===========================================================================

With additionall parameters output is 100% clean

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib repoze/tm/tests.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/repoze.tm2-2.1
plugins: mock-3.7.0
collected 26 items

repoze/tm/tests.py ..........................                                                                                                                        [100%]

=========================================================================== 26 passed in 10.55s ============================================================================

It woud be good to add those settings in pytest.ini.

@kloczek
Copy link
Author

kloczek commented Apr 22, 2022

Coverity passes as well

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --import-mode=importlib repoze/tm/tests.py --cov
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/repoze.tm2-2.1
plugins: mock-3.7.0, cov-3.0.0
collected 26 items

repoze/tm/tests.py ..........................                                                                                                                        [100%]

---------- coverage: platform linux, python 3.8.13-final-0 -----------
Name                                                                                                                          Stmts   Miss  Cover
-------------------------------------------------------------------------------------------------------------------------------------------------
/home/tkloczko/rpmbuild/BUILDROOT/python-repoze-tm2-2.1-9.fc35.x86_64/usr/lib/python3.8/site-packages/repoze/tm/__init__.py     101      0   100%
repoze/tm/__init__.py                                                                                                           101     83    18%
repoze/tm/tests.py                                                                                                              224      0   100%
-------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                                           426     83    81%


============================================================================ 26 passed in 0.31s ============================================================================

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

2 participants