question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.7.0: pytest is failing in `tests/test_main.py::test_output` units

See original GitHub issue

I just started transforming my all rpm packages with python modules to pep517 type builds and suddennly on testing build found that few units are failing.

Because I’m building python modules as rpm package 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-build-0.7.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-build-0.7.0-2.1.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly
=========================================================================== 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/build-0.7.0, configfile: setup.cfg
plugins: flaky-3.7.0, mock-3.6.1
collected 144 items

tests/test_env.py ..s...............                                                                                                                                 [ 12%]
tests/test_main.py ........................EEEEEE.........                                                                                                           [ 39%]
tests/test_module.py .                                                                                                                                               [ 40%]
tests/test_projectbuilder.py ...................................................                                                                                     [ 75%]
tests/test_util.py ....                                                                                                                                              [ 78%]
tests/test_integration.py sssssssssssssssssssssssssssssss                                                                                                            [100%]

================================================================================== ERRORS ==================================================================================
____________________________________________________________ ERROR at setup of test_output[via-sdist-isolation] ____________________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[via-sdist-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
__________________________________________________________ ERROR at setup of test_output[via-sdist-no-isolation] ___________________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[via-sdist-no-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
__________________________________________________________ ERROR at setup of test_output[wheel-direct-isolation] ___________________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[wheel-direct-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
_________________________________________________________ ERROR at setup of test_output[wheel-direct-no-isolation] _________________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[wheel-direct-no-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
_________________________________________________________ ERROR at setup of test_output[sdist-direct-no-isolation] _________________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[sdist-direct-no-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
____________________________________________________ ERROR at setup of test_output[sdist-and-wheel-direct-no-isolation] ____________________________________________________

self = <flaky.flaky_pytest_plugin.FlakyPlugin object at 0x7f4a9cbfd400>, item = <Function test_output[sdist-and-wheel-direct-no-isolation]>

    def pytest_runtest_setup(self, item):
        """
        Pytest hook to modify the test before it's run.

        :param item:
            The test item.
        """
        if not self._has_flaky_attributes(item):
            if hasattr(item, 'iter_markers'):
                for marker in item.iter_markers(name='flaky'):
>                   self._make_test_flaky(item, *marker.args, **marker.kwargs)
E                   TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'

/usr/lib/python3.8/site-packages/flaky/flaky_pytest_plugin.py:239: TypeError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_env.py:52: workaround for Apple Python
SKIPPED [30] tests/test_integration.py:70: integration tests not run (no --run-integration flag)
SKIPPED [1] tests/test_integration.py: integration tests not run (no --run-integration flag)
ERROR tests/test_main.py::test_output[via-sdist-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
ERROR tests/test_main.py::test_output[via-sdist-no-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
ERROR tests/test_main.py::test_output[wheel-direct-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
ERROR tests/test_main.py::test_output[wheel-direct-no-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
ERROR tests/test_main.py::test_output[sdist-direct-no-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
ERROR tests/test_main.py::test_output[sdist-and-wheel-direct-no-isolation] - TypeError: _make_test_flaky() got an unexpected keyword argument 'reruns'
========================================================== 106 passed, 32 skipped, 6 errors in 125.90s (0:02:05) ===========================================================

Buid is performed in minimal build ennv with only required modules.

[tkloczko@ss-desktop SPECS]$ pip list
Package                       Version
----------------------------- -------------------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         21.2.0
Babel                         2.9.1
build                         0.7.0
chardet                       4.0.0
charset-normalizer            2.0.9
cycler                        0.11.0
dbus-python                   1.2.18
distro                        1.6.0
docutils                      0.17.1
extras                        1.0.0
filelock                      3.4.0
fixtures                      3.0.0
flaky                         3.7.0
gpg                           1.16.0-unknown
idna                          3.3
imagesize                     1.2.0
importlib-metadata            4.10.0
iniconfig                     1.1.1
Jinja2                        3.0.3
kiwisolver                    1.3.2
libcomps                      0.1.18
lxml                          4.7.1
Mako                          1.1.6.dev0
Markdown                      3.3.6
MarkupSafe                    2.0.1
matplotlib                    3.5.1
meson                         0.60.3
mypy                          0.910
mypy-extensions               0.4.3
numpy                         1.21.4
olefile                       0.46
packaging                     21.3
pbr                           5.6.0
pep517                        0.12.0
Pillow                        8.4.0
pip                           21.3.1
pluggy                        1.0.0
psutil                        5.8.0
py                            1.11.0
Pygments                      2.10.0
PyGObject                     3.42.0
pyparsing                     3.0.6
pytest                        6.2.5
pytest-mock                   3.6.1
python-dateutil               2.8.2
pytz                          2021.1
requests                      2.26.0
rpm                           4.17.0
scour                         0.38.2
setuptools                    60.0.0.post20211220
setuptools-scm                6.3.2
six                           1.16.0
smartypants                   2.0.1
snowballstemmer               2.1.0
Sphinx                        4.3.2.dev20211220
sphinx-argparse-cli           1.8.2
sphinx-autodoc-typehints      1.12.0
sphinxcontrib-applehelp       1.0.2.dev20210802
sphinxcontrib-devhelp         1.0.2.dev20210801
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20210801
sphinxcontrib-qthelp          1.0.3.dev20210824
sphinxcontrib-serializinghtml 1.1.5
testtools                     2.5.0
toml                          0.10.2
tomli                         2.0.0
typing_extensions             4.0.1
typogrify                     2.0.7
urllib3                       1.26.7
wheel                         0.37.1
zipp                          3.6.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
laydaycommented, Jan 8, 2022

You are welcome.

Read more comments on GitHub >

github_iconTop Results From Across the Web

0.7.0: pytesty is failing · Issue #122 · python-trio/pytest ... - GitHub
I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on...
Read more >
Managing pytest's output — pytest documentation
Each test inside the file is shown by a single character in the output: . for passing, F for failure. test_words_fail failed, and...
Read more >
'pytest' exits with no error, but with "collected 0 items"
I wrote a unit test for this module (with a simple assert statement to check equality of lists) where I first instantiate the...
Read more >
pytest-cov - PyPI
Pytest plugin for measuring coverage. ... –cov-fail-under no longer causes pytest –collect-only to fail Contributed by Zac Hatfield-Dodds in #511.
Read more >
Effective Python Testing With Pytest
In this tutorial, you'll learn how to take your testing to the next level with pytest. You'll cover intermediate and advanced pytest ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found