Skip to content

Commit 14d66a6

Browse files
authored
Merge pull request #1419 from zm711/nix-warning
Testing: Add skip test for non-existent writable io if nixio is not installed
2 parents 791b400 + 32d0dc8 commit 14d66a6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

neo/test/iotest/test_get_io.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
from pathlib import Path
22
from tempfile import TemporaryDirectory
3+
import platform
34
from neo.io import get_io, list_candidate_ios, NixIO
5+
import pytest
6+
try:
7+
import nixio
8+
HAVE_NIX = True
9+
except:
10+
HAVE_NIX = False
411

512

613
def test_list_candidate_ios_non_existant_file():
@@ -28,7 +35,7 @@ def test_list_candidate_ios_filename_stub():
2835

2936
assert NixIO in ios
3037

31-
38+
@pytest.mark.skipif(not HAVE_NIX or platform.system()=='Windows', reason='Need nixio in order to return NixIO class')
3239
def test_get_io_non_existant_file_writable_io():
3340
# use nixio for testing with writable io
3441
non_existant_file = Path("non_existant_file.nix")
@@ -38,4 +45,4 @@ def test_get_io_non_existant_file_writable_io():
3845
assert isinstance(io, NixIO)
3946

4047
# cleanup
41-
non_existant_file.unlink(missing_ok=True)
48+
non_existant_file.unlink(missing_ok=True) # cleanup will fail on Windows so need to skip

0 commit comments

Comments
 (0)