-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathconftest.py
36 lines (27 loc) · 1.22 KB
/
conftest.py
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
import os
import warnings
import pytest
try:
from dagster import BetaWarning, PreviewWarning, SupersessionWarning
warnings.filterwarnings("ignore", category=BetaWarning)
warnings.filterwarnings("ignore", category=PreviewWarning)
warnings.filterwarnings("ignore", category=SupersessionWarning)
except ImportError:
pass # Not all test suites have dagster installed
def pytest_configure(config):
# Create a section break in the logs any time Buildkite invokes pytest
# https://buildkite.com/docs/pipelines/managing-log-output
# https://docs.pytest.org/en/7.1.x/reference/reference.html?highlight=pytest_configure#pytest.hookspec.pytest_configure
if os.getenv("BUILDKITE"):
print("+++ Running :pytest: PyTest") # noqa
# https://docs.pytest.org/en/7.1.x/example/markers.html#custom-marker-and-command-line-option-to-control-test-runs
config.addinivalue_line(
"markers", "integration: mark test to skip if DISABLE_INTEGRATION_TESTS is set."
)
def pytest_runtest_setup(item):
try:
next(item.iter_markers("integration"))
if os.getenv("CI_DISABLE_INTEGRATION_TESTS"):
pytest.skip("Integration tests are disabled")
except StopIteration:
pass