Skip to content

Commit 00a3966

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

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-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 self._reader is None or 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 (self._reader is None or 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def test_msa_index_path(self):
116116
msa = msa_file.indexed['does not exist']
117117

118118
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
119+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
119120
def test_msa_index_fileobj(self):
120121
luxc = resource_files("pyhmmer.tests").joinpath("data", "msa", "LuxC.sto")
121122
if not os.path.exists(luxc):

src/pyhmmer/tests/test_easel/test_sequencefile.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def test_sequence_index_path(self):
107107
seq = seq_file.indexed['does not exist']
108108

109109
@unittest.skipUnless(resource_files, "importlib.resources.files not available")
110+
@unittest.skipIf(platform.system() == "Windows", "unsupported on Windows")
110111
def test_sequence_index_path_format_error(self):
111112
luxc = resource_files("pyhmmer.tests").joinpath("data", "seqs", "938293.PRJEB85.HG003687.faa")
112113
if not os.path.exists(luxc):
@@ -120,6 +121,7 @@ def test_sequence_index_path_format_error(self):
120121
seq = seq_file.indexed['938293.PRJEB85.HG003684_1']
121122

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

0 commit comments

Comments
 (0)