Skip to content
Snippets Groups Projects
Commit 9c9475f7 authored by David Douard's avatar David Douard
Browse files

Prevent root conftest.py from loading swh.core at module loading time

move the import statement in swhmain() body.
Having the swh.core module loaded with the execution of conftest.py can
have weird side effects, especially on pytest's discovery mechanism in
the context of tox, namely make pytest load test files from the source
directory rather than from the installed package in the tox venv,
potentially leading to ImportPathMismatchError.
parent 1bee4ce5
No related branches found
Tags v2.0.0
No related merge requests found
from hypothesis import settings
import pytest
from swh.core.cli import swh as _swhmain
# define tests profile. Full documentation is at:
# https://hypothesis.readthedocs.io/en/latest/settings.html#settings-profiles
settings.register_profile("fast", max_examples=5, deadline=5000)
......@@ -13,6 +11,8 @@ settings.register_profile("slow", max_examples=20, deadline=5000)
def swhmain():
"""Yield an instance of the main `swh` click command that cleans the added
subcommands up on teardown."""
from swh.core.cli import swh as _swhmain
commands = _swhmain.commands.copy()
aliases = _swhmain.aliases.copy()
yield _swhmain
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment