Skip to content

Commit fc7305b

Browse files
committed
Disable SequenceFile.indexed and MSAFile.indexed on Windows as seeking is unavailable
1 parent e734f84 commit fc7305b

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

src/pyhmmer/easel.pyx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6774,20 +6774,21 @@ cdef class MSAFile:
67746774
raise err
67756775

67766776
# open index, if any
6777-
if index is not None:
6778-
self.index = index
6779-
self._msaf.ssi = self.index._ssi
6780-
elif self._reader is None:
6781-
try:
6782-
ssiname = f"{self.name}.ssi"
6783-
self.index = SSIReader(ssiname)
6784-
except FileNotFoundError:
6785-
self.index = None
6786-
except Exception as err:
6787-
PyErr_WarnFormat(RuntimeWarning, 1, "%S", <PyObject*> err)
6788-
self.index = None
6789-
else:
6777+
if TARGET_SYSTEM != "Windows":
6778+
if index is not None:
6779+
self.index = index
67906780
self._msaf.ssi = self.index._ssi
6781+
elif self._reader is None:
6782+
try:
6783+
ssiname = f"{self.name}.ssi"
6784+
self.index = SSIReader(ssiname)
6785+
except FileNotFoundError:
6786+
self.index = None
6787+
except Exception as err:
6788+
PyErr_WarnFormat(RuntimeWarning, 1, "%S", <PyObject*> err)
6789+
self.index = None
6790+
else:
6791+
self._msaf.ssi = self.index._ssi
67916792

67926793
def __dealloc__(self):
67936794
if self._msaf != NULL:
@@ -9293,7 +9294,7 @@ cdef class SequenceFile:
92939294
raise err
92949295

92959296
# open index, if any
9296-
if self._sqfp.format != libeasel.sqio.eslSQFILE_NCBI:
9297+
if self._sqfp.format != libeasel.sqio.eslSQFILE_NCBI and TARGET_SYSTEM != "Windows":
92979298
if index is not None:
92989299
self.index = index
92999300
self._sqfp.data.ascii.ssi = self.index._ssi

src/pyhmmer/tests/test_easel/test_msafile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_secondary_structure(self):
8282
self.assertEqual(msa.secondary_structure, "......>>>>+>> ^^^^ <<<<<<......")
8383

8484
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
85+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
8586
def test_msa_index_path_format_error(self):
8687
luxc = resource_files("pyhmmer.tests").joinpath("data", "msa", "LuxC.sto")
8788
if not os.path.exists(luxc):
@@ -95,6 +96,7 @@ def test_msa_index_path_format_error(self):
9596
msa = msa_file.indexed['LuxC']
9697

9798
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
99+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
98100
def test_msa_index_path(self):
99101
luxc = resource_files("pyhmmer.tests").joinpath("data", "msa", "LuxC.sto")
100102
if not os.path.exists(luxc):
@@ -116,6 +118,7 @@ def test_msa_index_path(self):
116118
msa = msa_file.indexed['does not exist']
117119

118120
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
121+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
119122
def test_msa_index_fileobj(self):
120123
luxc = resource_files("pyhmmer.tests").joinpath("data", "msa", "LuxC.sto")
121124
if not os.path.exists(luxc):

src/pyhmmer/tests/test_easel/test_sequencefile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_ignore_gaps(self):
8585
self.assertEqual(len(sequences), 13)
8686

8787
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
88+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
8889
def test_sequence_index_path(self):
8990
luxc = resource_files("pyhmmer.tests").joinpath("data", "seqs", "938293.PRJEB85.HG003687.faa")
9091
if not os.path.exists(luxc):
@@ -107,6 +108,7 @@ def test_sequence_index_path(self):
107108
seq = seq_file.indexed['does not exist']
108109

109110
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
111+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
110112
def test_sequence_index_path_format_error(self):
111113
luxc = resource_files("pyhmmer.tests").joinpath("data", "seqs", "938293.PRJEB85.HG003687.faa")
112114
if not os.path.exists(luxc):
@@ -120,6 +122,7 @@ def test_sequence_index_path_format_error(self):
120122
seq = seq_file.indexed['938293.PRJEB85.HG003684_1']
121123

122124
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
125+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
123126
def test_sequence_index_fileobj(self):
124127
luxc = resource_files("pyhmmer.tests").joinpath("data", "seqs", "938293.PRJEB85.HG003687.faa")
125128
if not os.path.exists(luxc):

0 commit comments

Comments
 (0)