This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
forked from pydata/xarray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove deprecated pytest.config usages (pydata#2988)
* initial attempt at moving away from deprecated pytest.config * whatsnew
- Loading branch information
Showing
3 changed files
with
24 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
"""Configuration for pytest.""" | ||
|
||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
"""Add command-line flags for pytest.""" | ||
parser.addoption("--run-flaky", action="store_true", | ||
help="runs flaky tests") | ||
parser.addoption("--run-network-tests", action="store_true", | ||
help="runs tests requiring a network connection") | ||
|
||
|
||
def pytest_collection_modifyitems(config, items): | ||
|
||
if not config.getoption("--run-flaky"): | ||
skip_flaky = pytest.mark.skip( | ||
reason="set --run-flaky option to run flaky tests") | ||
for item in items: | ||
if "flaky" in item.keywords: | ||
item.add_marker(skip_flaky) | ||
|
||
if not config.getoption("--run-network-tests"): | ||
skip_network = pytest.mark.skip( | ||
reason="set --run-network-tests option to run tests requiring an" | ||
"internet connection") | ||
for item in items: | ||
if "network" in item.keywords: | ||
item.add_marker(skip_network) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters