Skip to content

Commit

Permalink
[MAINT] mark failing test as xfail (#101)
Browse files Browse the repository at this point in the history
* mark test as xfail

* add another

* use color

* xfail more
  • Loading branch information
Remi-Gau authored Sep 5, 2024
1 parent 9a82cdc commit 55106df
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
name: test

# Force to use color
env:
FORCE_COLOR: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ module = [
]

[tool.pytest.ini_options]
addopts = "-ra -q -vv --cov eye2bids --durations=0"
addopts = "-ra --strict-config --strict-markers -q -vv --cov eye2bids --durations=0"
norecursedirs = "data"
testpaths = ["tests/"]
31 changes: 26 additions & 5 deletions tests/test_edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,15 @@ def _check_output_content(output_dir, input_file, eye=1):

# space between timestamps should always be the same.
if ending == "_physio":
# length is because first rwo will give a nan
# length is because first row will give a nan
assert len(df[0].diff().unique()) == 2


@pytest.mark.parametrize(
"folder",
[
"emg",
"lt",
"pitracker",
"rest",
"vergence",
],
)
@pytest.mark.skipif(not _check_edf2asc_present(), reason="edf2asc missing")
Expand All @@ -106,6 +103,29 @@ def test_edf_end_to_end_all(eyelink_test_data_dir, folder):
_check_output_content(output_dir, input_file)


@pytest.mark.xfail(reason="Output is not a continuous recording. See #69.")
@pytest.mark.parametrize(
"folder",
["emg", "lt", "vergence"],
)
@pytest.mark.skipif(not _check_edf2asc_present(), reason="edf2asc missing")
def test_edf_end_to_end_emg_xfail(eyelink_test_data_dir, folder):
"""Run conversion of all test datasets and check output."""
metadata_file = data_dir() / "metadata.yml"

input_dir = eyelink_test_data_dir / folder
input_file = edf_test_files(input_dir=input_dir)[0]

output_dir = data_dir() / "output"
output_dir.mkdir(exist_ok=True)

edf2bids(input_file=input_file, metadata_file=metadata_file, output_dir=output_dir)

_check_output_exists(output_dir, input_file)
_check_output_content(output_dir, input_file)


@pytest.mark.xfail(reason="Output is not a continuous recording. See #69.")
@pytest.mark.skipif(not _check_edf2asc_present(), reason="edf2asc missing")
def test_edf_end_to_end(eyelink_test_data_dir):
metadata_file = data_dir() / "metadata.yml"
Expand All @@ -119,7 +139,6 @@ def test_edf_end_to_end(eyelink_test_data_dir):
edf2bids(input_file=input_file, metadata_file=metadata_file, output_dir=output_dir)

_check_output_exists(output_dir, input_file)
_check_output_content(output_dir, input_file)

expected_events_sidecar = output_dir / f"{input_file.stem}_events.json"
with open(expected_events_sidecar) as f:
Expand All @@ -132,6 +151,8 @@ def test_edf_end_to_end(eyelink_test_data_dir):
assert eyetrack["SamplingFrequency"] == 500
assert eyetrack["RecordedEye"] == "Right"

_check_output_content(output_dir, input_file)


@pytest.mark.skipif(not _check_edf2asc_present(), reason="edf2asc missing")
def test_edf_end_to_end_error_no_metadata(eyelink_test_data_dir):
Expand Down

0 comments on commit 55106df

Please sign in to comment.