Skip to content

Commit a1088d7

Browse files
committed
added integration test and updated docs
1 parent 2c1efab commit a1088d7

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

MSMetaEnhancer/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ async def annotate_spectra(
8383

8484
# start converters status checker and wait for first status
8585
try:
86-
monitor.start()
86+
if not monitor.is_alive():
87+
monitor.start()
8788
monitor.first_check.wait()
8889

8990
# create all possible jobs if not given

MSMetaEnhancer/libs/utils/Monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def run(self):
5555
Such a converter is considered available.
5656
This is checked periodically to always have up-to-date information.
5757
"""
58-
while not self.stop_request.isSet():
58+
while not self.stop_request.is_set():
5959
for converter in self.converters.values():
6060
url = self.get_base_url(converter)
6161
converter.is_available = self.check_service(url)

tests/test_integration.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,34 @@
88

99
ConverterBuilder.register([CTS, CIR, IDSM, PubChem, BridgeDb, RDKit])
1010

11+
1112
def test_integration(tmp_path):
1213
app = Application()
1314

1415
# import your .msp file
15-
app.load_data('tests/test_data/sample.msp', file_format='msp')
16+
app.load_data("tests/test_data/sample.msp", file_format="msp")
1617

1718
# curate given metadata (e.g. fix CAS numbers)
1819
app.curate_metadata()
1920

2021
# specify requested services (these are supported)
21-
services = ['CTS', 'CIR', 'IDSM', 'PubChem', 'BridgeDb', 'RDKit']
22+
services = ["CTS", "CIR", "IDSM", "PubChem", "BridgeDb", "RDKit"]
2223

2324
# specify requested jobs
24-
jobs = [('name', 'inchi', 'IDSM'), ('inchi', 'formula', 'IDSM'), ('inchi', 'inchikey', 'IDSM'),
25-
('inchi', 'iupac_name', 'IDSM'), ('inchi', 'canonical_smiles', 'IDSM')]
25+
jobs = [
26+
("compound_name", "inchi", "IDSM"),
27+
("inchi", "formula", "IDSM"),
28+
("inchi", "inchikey", "IDSM"),
29+
("inchi", "iupac_name", "IDSM"),
30+
("inchi", "canonical_smiles", "IDSM"),
31+
]
2632

2733
# run asynchronous annotations of spectra data
2834
asyncio.run(app.annotate_spectra(services, jobs))
2935

3036
# export .msp file
31-
outpath = os.path.join(tmp_path, 'sample_out.msp')
32-
app.save_data(outpath, file_format='msp')
37+
outpath = os.path.join(tmp_path, "sample_out.msp")
38+
app.save_data(outpath, file_format="msp")
3339
assert os.path.isfile(outpath)
3440

35-
os.remove(outpath)
41+
os.remove(outpath)

0 commit comments

Comments
 (0)