Skip to content

Commit 5b7e470

Browse files
Configure pytest marks in a central location in pyproject.toml (#275)
1 parent 0260e2c commit 5b7e470

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

pins/tests/conftest.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
PATH_TO_MANIFEST_BOARD = files("pins") / "tests/pin-board"
1616

17-
# Based on https://github.com/machow/siuba/blob/main/siuba/tests/helpers.py
18-
BACKEND_MARKS = ["fs_s3", "fs_file", "fs_gcs", "fs_abfs", "fs_rsc"]
19-
2017
# parameters that can be used more than once per session
2118
params_safe = [
2219
pytest.param(lambda: BoardBuilder("file"), id="file", marks=m.fs_file),
@@ -82,12 +79,3 @@ def tmp_data_dir():
8279

8380
def pytest_addoption(parser):
8481
parser.addoption("--snapshot-update", action="store_true")
85-
86-
87-
def pytest_configure(config):
88-
# TODO: better way to define all marks? Can we iterate over params above?
89-
for mark_name in BACKEND_MARKS:
90-
fs_name = mark_name.split("_")[-1]
91-
config.addinivalue_line(
92-
"markers", f"{mark_name}: mark test to only run on {fs_name} filesystem."
93-
)

pyproject.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ find = { namespaces = false }
7373
universal = 1
7474

7575
[tool.pytest.ini_options]
76+
markers = [
77+
"fs_file: mark test to only run on local filesystem",
78+
"fs_s3: mark test to only run on AWS S3 bucket filesytem",
79+
"fs_gcs: mark test to only run on Google Cloud Storage bucket filesystem",
80+
"fs_abfs: mark test to only run on Azure Datalake filesystem",
81+
"fs_rsc: mark test to only run on Posit Connect filesystem",
82+
"skip_on_github: skip this test if running on GitHub",
83+
]
7684
testpaths = ["pins"]
7785
addopts = "--doctest-modules"
7886
doctest_optionflags = "NORMALIZE_WHITESPACE"
79-
markers = ["skip_on_github: skip this test if running on github"]
87+
8088
[tool.ruff]
8189
line-length = 90
8290
extend-exclude = ["docs"]

0 commit comments

Comments
 (0)