Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Catch warning when loaded text file contains no data in test #156

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions nireports/tests/test_reportlets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import contextlib
import os
import warnings
from itertools import permutations
from pathlib import Path

Expand Down Expand Up @@ -237,14 +238,20 @@ def test_plot_melodic_components(tmp_path, outdir):
out_file=all_noise,
)
# run command with no noise components
plot_melodic_components(
str(melodic_dir),
in_fname,
tr=2.0,
report_mask=report_fname,
noise_components_file=nocomps_file,
out_file=no_noise,
)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="loadtxt: input contained no data",
category=UserWarning,
)
jhlegarreta marked this conversation as resolved.
Show resolved Hide resolved
plot_melodic_components(
str(melodic_dir),
in_fname,
tr=2.0,
report_mask=report_fname,
noise_components_file=nocomps_file,
out_file=no_noise,
)

# run command without noise components file
plot_melodic_components(
Expand Down
Loading