Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit 837a6a68 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

hg-native: new markers to skip tests

This introduces `@needs.hg_git` and `@needs.hg_native` markers
to skip tests if `--heptapod-hg-native` is passed or isn't,
respectively.
parent cbea8f0445ab
......@@ -110,6 +110,16 @@ def pytest_configure(config):
"services: mark test as needing services "
"management "
)
# if we regroup the tests with separate fixtures for the two
# modes, these two will become useless:
config.addinivalue_line("markers",
"hg_git: mark test as running only if "
"session is *not* in hg-native mode"
)
config.addinivalue_line("markers",
"hg_native: mark test as running only if "
"session is in hg-native mode"
)
def pytest_collection_modifyitems(config, items):
......@@ -121,6 +131,8 @@ def pytest_collection_modifyitems(config, items):
"running these tests")
skip_services = pytest.mark.skip(
reason="needs to manage Heptapod services")
skip_hg_git = pytest.mark.skip(reason="needs non hg-native mode")
skip_hg_native = pytest.mark.skip(reason="needs hg-native mode")
no_reverse_call = not(config.getoption('heptapod_reverse_call_host'))
remote = config.getoption('heptapod_remote')
......@@ -128,6 +140,7 @@ def pytest_collection_modifyitems(config, items):
gdk = config.getoption('heptapod_gdk')
omnibus = config.getoption('heptapod_omnibus')
docker = not (gdk or source_install or remote or omnibus)
hg_native = config.getoption("heptapod_hg_native")
for item in items:
if remote and "fs_access" in item.keywords:
......@@ -138,6 +151,10 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(skip_reverse_call)
if "services" in item.keywords and (remote or source_install):
item.add_marker(skip_services)
if "hg_git" in item.keywords and hg_native:
item.add_marker(skip_hg_git)
if "hg_native" in item.keywords and not hg_native:
item.add_marker(skip_hg_native)
heptapod_instance = None
......
......@@ -4,3 +4,4 @@ fs_access = pytest.mark.fs_access
docker = pytest.mark.docker
reverse_call = pytest.mark.reverse_call
services = pytest.mark.services
hg_git = pytest.mark.hg_git
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment