Skip to content

Commit 46738f8

Browse files
Merge pull request #2 from LinearParadox/dev
merge dev into main
2 parents 719bf4c + 07b8801 commit 46738f8

File tree

3 files changed

+458
-398
lines changed

3 files changed

+458
-398
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ dev = [
2525
"mypy-extensions>=1.0.0",
2626
"pandas-stubs>=2.2.3.250308",
2727
"pytest>=8.3.5",
28+
"pytest-cov>=6.1.1",
2829
"ruff>=0.11.5",
2930
"scanpy>=1.11.1",
3031
"scipy-stubs>=1.15.2.1",

src/loupepy/convert.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,15 @@ def create_loupe_from_anndata(anndata: AnnData, output_cloupe: str | PathLike =
118118
ValueError: If the obs keys are not valid.
119119
ValueError: If the feature ids are not valid.
120120
'''
121-
if loupe_converter_path is None and not test_mode:
122-
loupe_converter_path = _get_loupe_path()
123-
if not os.path.exists(loupe_converter_path) and not test_mode:
121+
if not test_mode:
124122
if loupe_converter_path is None:
125-
raise ValueError('Loupe converter Not found at default install location.'
126-
'Please run loupepy.setup() to install it or provide a path to the executable.')
127-
else:
128-
raise ValueError(f'Loupe converter not found at {loupe_converter_path}. Please provide a valid path.')
123+
loupe_converter_path = _get_loupe_path()
124+
if not os.path.exists(loupe_converter_path) and not test_mode:
125+
if loupe_converter_path is None:
126+
raise ValueError('Loupe converter Not found at default install location.'
127+
'Please run loupepy.setup() to install it or provide a path to the executable.')
128+
else:
129+
raise ValueError(f'Loupe converter not found at {loupe_converter_path}. Please provide a valid path.')
129130
if test_mode:
130131
logging.warning("Test mode is enabled. Loupe file will not be created.")
131132
clean_tmp_file = False
@@ -172,10 +173,11 @@ def create_loupe(mat: csc_matrix,
172173
_write_hdf5(mat, obs, var, obsm, tmp_file, feature_ids=feature_ids)
173174
if test_mode:
174175
return
175-
if loupe_converter_path is None:
176-
loupe_converter_path = _get_loupe_path()
177-
if not os.path.exists(loupe_converter_path):
178-
raise ValueError('Loupe converter path does not exist')
176+
if not test_mode:
177+
if loupe_converter_path is None:
178+
loupe_converter_path = _get_loupe_path()
179+
if not os.path.exists(loupe_converter_path):
180+
raise ValueError('Loupe converter path does not exist')
179181
cmd = f"{loupe_converter_path} create --input={tmp_file} --output={output_path}"
180182
if force:
181183
cmd += " --force"

0 commit comments

Comments
 (0)