Page MenuHomeSoftware Heritage

Makefile.local: Ensure all tests are executed when invoking make test
ClosedPublic

Authored by anlambert on Nov 19 2020, 12:54 PM.

Details

Summary

Some tests location were missing in the TEST_DIRS make variable.

Also add a commit to remove explicit pytest_plugins declaration.
This makes pytest fails in a virtualenv (see below) as it attempts to load the aiohttp
pytest plugin multiple times so prefer to rely on pytest-aiohttp instead.

12:50 $ pytest -sv swh/core/api/tests/
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.3, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /home/anlambert/.virtualenvs/swh/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/anlambert/swh/swh-environment/swh-core/.hypothesis/examples')
rootdir: /home/anlambert/swh/swh-environment/swh-core, configfile: pytest.ini
plugins: aiohttp-0.3.0, asyncio-0.14.0, django-3.9.0, mock-3.3.1, requests-mock-1.8.0, hypothesis-5.33.1, flask-1.0.0, forked-1.3.0, xdist-2.1.0, dash-1.16.0, postgresql-2.4.1, swh.journal-0.4.4.dev1+g7815cad, swh.core-0.8.1.dev4+g39d8579.d20201119
collected 46 items / 1 error / 45 selected                                                                                                                                                                       

===================================================================================================== ERRORS =====================================================================================================
_______________________________________________________________________________ ERROR collecting swh/core/api/tests/test_async.py ________________________________________________________________________________
../../../.virtualenvs/swh/lib/python3.7/site-packages/pluggy/manager.py:127: in register
    hook._maybe_apply_history(hookimpl)
../../../.virtualenvs/swh/lib/python3.7/site-packages/pluggy/hooks.py:333: in _maybe_apply_history
    res = self._hookexec(self, [method], kwargs)
../../../.virtualenvs/swh/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../../../.virtualenvs/swh/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../../.virtualenvs/swh/lib/python3.7/site-packages/aiohttp/pytest_plugin.py:38: in pytest_addoption
    help="run tests faster by disabling extra checks",
../../../.virtualenvs/swh/lib/python3.7/site-packages/_pytest/config/argparsing.py:96: in addoption
    self._anonymous.addoption(*opts, **attrs)
../../../.virtualenvs/swh/lib/python3.7/site-packages/_pytest/config/argparsing.py:352: in addoption
    raise ValueError("option names %s already added" % conflict)
E   ValueError: option names {'--aiohttp-fast'} already added

Diff Detail

Event Timeline

Build is green

Patch application report for D4522 (id=16025)

Rebasing onto 12b0e76def...

Current branch diff-target is up to date.
Changes applied before test
commit c5f275fa60ad2e9f8fa2ab3b40f2d94b9631c3ec
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Nov 19 12:11:35 2020 +0100

    Makefile.local: Ensure all tests are executed when invoking make test

commit 6df78150be4723c17a95715ae5caca9151e1ad97
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Nov 19 12:10:47 2020 +0100

    tests/test_async: Remove explicit pytest_plugins declaration
    
    This makes pytest fails in a virtualenv as it attempts to load the aiohttp
    pytest plugin multiple times so prefer to rely on pytest-aiohttp instead.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/135/ for more details.

This makes pytest fails in a virtualenv (see below) as it attempts to load the aiohttp
pytest plugin multiple times so prefer to rely on pytest-aiohttp instead.

Because swh-vault declares pytest-aiohttp in its requirements-test.txt

So two options here:

  • either we rely on explicit pytest_plugins declaration in swh-core and swh-vault tests
  • either we declare the use of pytest-aiohttp in requirements-test.txt files

The first option has the advantage to only load the aiohttp pytest plugin when required and thus can prevent possible pytest fixture name clash.

Update: Revert modifications related to aiohttp pytest plugin, the issue I encountered
is due to a side effect from swh-vault which installs pytest-aiohttp as test dependency.
That dependency should be removed in favor of the explicit declaration of the aiohttp pytest
plugin in vault root conftest.py.

Build is green

Patch application report for D4522 (id=16072)

Rebasing onto 12b0e76def...

Current branch diff-target is up to date.
Changes applied before test
commit e2bd9c319b4e34a2c28cd1c45c898bd6050bac52
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Thu Nov 19 12:11:35 2020 +0100

    Makefile.local: Ensure all tests are executed when invoking make test

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/139/ for more details.

This revision is now accepted and ready to land.Nov 19 2020, 5:47 PM