Skip to content

Commit

Permalink
[CI] Fix pytest warnings being raised on CI (#169)
Browse files Browse the repository at this point in the history
* Fix ci

Signed-off-by: Adam Li <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix pre-commit

Signed-off-by: Adam Li <[email protected]>

* Fix unit-tests

Signed-off-by: Adam Li <[email protected]>

* improve style and run stubgen

* avoid shadowing of builtin

* fix tests and pin pytest to 8.0 or above

* fix ruff configuration deprecation warnings

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Adam Li <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mscheltienne <[email protected]>
  • Loading branch information
3 people authored Feb 5, 2024
1 parent 42397df commit 8300ad3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion mne_icalabel/datasets/icalabel/icalabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def data_path(
download : bool
If False and the dataset has not been downloaded yet,
it will not be downloaded and the path will be returned
as ‘’ (empty string). This is mostly used for debugging purposes
as ``‘’`` (empty string). This is mostly used for debugging purposes
and can be safely ignored by most users.
%(verbose)s
Expand Down
2 changes: 1 addition & 1 deletion mne_icalabel/datasets/icalabel/icalabel.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def data_path(
download : bool
If False and the dataset has not been downloaded yet,
it will not be downloaded and the path will be returned
as ‘’ (empty string). This is mostly used for debugging purposes
as ``‘’`` (empty string). This is mostly used for debugging purposes
and can be safely ignored by most users.
verbose : bool | str | int | None
Expand Down
8 changes: 4 additions & 4 deletions mne_icalabel/iclabel/tests/test_label_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ def test_warnings():
random_state=101,
)
ica.fit(raw)
with pytest.warns(RuntimeWarning, match="common average reference"):
with pytest.warns(RuntimeWarning, match="common average reference"), pytest.warns(
RuntimeWarning, match="not filtered between 1 and 100 Hz"
):
iclabel_label_components(raw, ica)
with pytest.warns(RuntimeWarning, match="not filtered between 1 and 100 Hz"):
iclabel_label_components(raw, ica)

with raw.info._unlock():
raw.info["lowpass"] = 100.0
raw.set_eeg_reference("average")

# infomax
ica = ICA(
n_components=3,
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ test = [
'pandas',
'pymatreader',
'PyQt6',
'pytest',
'pytest-cov',
'pytest>=8.0.0',
]
torch = [
'torch',
Expand Down Expand Up @@ -185,22 +185,24 @@ match-dir = '^mne_icalabel.*'
[tool.pytest.ini_options]
addopts = '--durations 20 --junit-xml=junit-results.xml -v --color=yes'
junit_family = 'xunit2'
minversion = '6.0'
minversion = '8.0'

[tool.ruff]
extend-exclude = [
'doc',
'setup.py',
]
ignore = []
line-length = 88
select = ["E", "F", "UP", "W"]
target-version = 'py39'

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.per-file-ignores]
[tool.ruff.lint]
ignore = []
select = ["E", "F", "UP", "W"]

[tool.ruff.lint.per-file-ignores]
'*' = [
"UP007", # 'Use `X | Y` for type annotations', requires python 3.10
]
Expand Down
4 changes: 2 additions & 2 deletions tools/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
isort.file(stub, config=config_isort)

# run ruff to improve stub style
exec = subprocess.run(["ruff", "format", str(directory), "--config", config])
sys.exit(exec.returncode)
execution = subprocess.run(["ruff", "format", str(directory), "--config", config])
sys.exit(execution.returncode)

0 comments on commit 8300ad3

Please sign in to comment.