Skip to content

Makefile.local: Fix test target execution

Explicitly pass tests folder as paramter when invoking pytest in order for the hypothesis profiles to be found.

This is what we get otherwise:

(swh) ✘-2 ~/swh/swh-environment/swh-storage [master|✚ 1…1⚑ 11] 
14:52 $ make test
python3 -m pytest --hypothesis-profile=fast .
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/hypothesis/_settings.py", line 351, in get_profile
INTERNALERROR>     return settings._profiles[name]
INTERNALERROR> KeyError: 'fast'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/_pytest/main.py", line 189, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/_pytest/config/__init__.py", line 717, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/hooks.py", line 308, in call_historic
INTERNALERROR>     res = self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/manager.py", line 92, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/manager.py", line 86, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/hypothesis/extra/pytestplugin.py", line 90, in pytest_configure
INTERNALERROR>     settings.load_profile(profile)
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/hypothesis/_settings.py", line 366, in load_profile
INTERNALERROR>     settings._assign_default_internal(settings.get_profile(name))
INTERNALERROR>   File "/home/antoine/.virtualenvs/swh/lib/python3.7/site-packages/hypothesis/_settings.py", line 353, in get_profile
INTERNALERROR>     raise InvalidArgument("Profile %r is not registered" % (name,))
INTERNALERROR> hypothesis.errors.InvalidArgument: Profile 'fast' is not registered
make: *** [../Makefile.python:24: test] Error 3

Migrated from D2356 (view on Phabricator)

Merge request reports

Loading