Skip to content

Commit

Permalink
Use pytest-env to capture warnings on CI runs (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo authored Mar 25, 2024
1 parent 12b567f commit 9ea6a1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ tests = [
"pep8-naming",
"pytest",
"pytest-cov",
"pytest-env",
]
maint = [
"fuzzywuzzy",
Expand Down Expand Up @@ -176,6 +177,9 @@ markers = [
"fmriprep_without_freesurfer: mark integration test for fMRIPrep derivatives without FreeSurfer",
"nibabies: mark integration test for nibabies derivatives",
]
env = [
"RUNNING_PYTEST = 1",
]

[tool.coverage.run]
branch = true
Expand Down
5 changes: 3 additions & 2 deletions xcp_d/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@

if not hasattr(sys, "_is_pytest_session"):
sys._is_pytest_session = False # Trick to avoid sklearn's FutureWarnings

# Disable all warnings in main and children processes only on production versions
if not any(
if ("RUNNING_PYTEST" not in os.environ) and not any(
(
"+" in __version__,
__version__.endswith(".dirty"),
Expand Down Expand Up @@ -463,7 +464,7 @@ def init(cls):
if cls.participant_label:
# Ignore any subjects who aren't the requested ones.
ignore_patterns.append(
re.compile(r'sub-(?!' + '|'.join(cls.participant_label) + r')\w+')
re.compile(r"sub-(?!" + "|".join(cls.participant_label) + r")\w+")
)

_indexer = BIDSLayoutIndexer(
Expand Down

0 comments on commit 9ea6a1c

Please sign in to comment.