forked from localstack/localstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
51 lines (41 loc) · 1.53 KB
/
conftest.py
File metadata and controls
51 lines (41 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import os
import pytest
from _pytest.config import PytestPluginManager
from _pytest.config.argparsing import Parser
os.environ["LOCALSTACK_INTERNAL_TEST_RUN"] = "1"
pytest_plugins = [
"localstack.testing.pytest.fixtures",
"localstack.testing.pytest.snapshot",
"localstack.testing.pytest.filters",
"localstack.testing.pytest.fixture_conflicts",
]
@pytest.hookimpl
def pytest_addoption(parser: Parser, pluginmanager: PytestPluginManager):
parser.addoption(
"--offline",
action="store_true",
default=False,
help="test run will not have an internet connection",
)
def pytest_configure(config):
config.addinivalue_line(
"markers",
"skip_offline: mark the test to be skipped when the tests are run offline "
"(this test explicitly / semantically needs an internet connection)",
)
config.addinivalue_line(
"markers",
"aws_validated: mark the test as validated / verified against real AWS",
)
def pytest_collection_modifyitems(config, items):
if not config.getoption("--offline"):
# The tests are not executed offline, so we don't skip the tests marked to need an internet connection
return
skip_offline = pytest.mark.skip(
reason="Test cannot be executed offline / in a restricted network environment. "
"Add network connectivity and remove the --offline option when running "
"the test."
)
for item in items:
if "skip_offline" in item.keywords:
item.add_marker(skip_offline)