Skip to content

Commit 7dd6616

Browse files
committed
Add @pytest.mark.remote to integration fetcher tests
Applied the @pytest.mark.remote decorator to all test methods in TestFetcher that require remote data fetching. This change helps to distinguish tests that depend on external resources, allowing for selective test execution.
1 parent 4ef1f52 commit 7dd6616

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/integration/test_fetcher.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
23
from pyenzyme.fetcher.chebi import fetch_chebi
34
from pyenzyme.fetcher.pdb import fetch_pdb
45
from pyenzyme.fetcher.pubchem import fetch_pubchem
@@ -7,6 +8,7 @@
78

89

910
class TestFetcher:
11+
@pytest.mark.remote
1012
def test_fetch_chebi_to_small_molecule(self):
1113
small_molecule = fetch_chebi("CHEBI:15377")
1214
assert small_molecule is not None
@@ -22,6 +24,7 @@ def test_fetch_chebi_to_small_molecule(self):
2224
== "https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:15377"
2325
)
2426

27+
@pytest.mark.remote
2528
def test_fetch_chebi_to_small_molecule_with_id(self):
2629
small_molecule = fetch_chebi("CHEBI:15377", smallmol_id="s1")
2730
assert small_molecule is not None
@@ -37,10 +40,12 @@ def test_fetch_chebi_to_small_molecule_with_id(self):
3740
== "https://www.ebi.ac.uk/chebi/searchId.do?chebiId=CHEBI:15377"
3841
)
3942

43+
@pytest.mark.remote
4044
def test_fetch_chebi_to_small_molecule_invalid_id(self):
4145
with pytest.raises(ValueError):
4246
fetch_chebi("INVALID_ID")
4347

48+
@pytest.mark.remote
4449
def test_fetch_uniprot_to_protein(self):
4550
protein = fetch_uniprot("P07327")
4651
assert protein is not None
@@ -57,6 +62,7 @@ def test_fetch_uniprot_to_protein(self):
5762
assert len(protein.references) == 1
5863
assert protein.references[0] == "https://www.uniprot.org/uniprotkb/P07327"
5964

65+
@pytest.mark.remote
6066
def test_fetch_uniprot_to_protein_with_prefix(self):
6167
protein = fetch_uniprot("uniprot:P07327")
6268
assert protein is not None
@@ -73,6 +79,7 @@ def test_fetch_uniprot_to_protein_with_prefix(self):
7379
assert len(protein.references) == 1
7480
assert protein.references[0] == "https://www.uniprot.org/uniprotkb/P07327"
7581

82+
@pytest.mark.remote
7683
def test_fetch_uniprot_to_protein_with_id(self):
7784
protein = fetch_uniprot("P07327", protein_id="p1")
7885
assert protein is not None
@@ -89,6 +96,7 @@ def test_fetch_uniprot_to_protein_with_id(self):
8996
assert len(protein.references) == 1
9097
assert protein.references[0] == "https://www.uniprot.org/uniprotkb/P07327"
9198

99+
@pytest.mark.remote
92100
def test_fetch_rhea_to_reaction(self):
93101
reaction, small_molecules = fetch_rhea("RHEA:22864")
94102

@@ -114,10 +122,12 @@ def test_fetch_rhea_to_reaction(self):
114122
assert reaction.products[0].stoichiometry == 1
115123
assert reaction.products[0].species_id == small_molecules[0].id
116124

125+
@pytest.mark.remote
117126
def test_fetch_rhea_to_reaction_invalid_id(self):
118127
with pytest.raises(ValueError):
119128
fetch_rhea("INVALID_ID")
120129

130+
@pytest.mark.remote
121131
def test_fetch_pubchem_to_small_molecule(self):
122132
small_molecule = fetch_pubchem(cid="2244")
123133
assert small_molecule is not None
@@ -130,6 +140,7 @@ def test_fetch_pubchem_to_small_molecule(self):
130140
== "InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)"
131141
)
132142

143+
@pytest.mark.remote
133144
def test_fetch_pubchem_to_small_molecule_with_prefix(self):
134145
small_molecule = fetch_pubchem(cid="pubchem:2244")
135146
assert small_molecule is not None
@@ -142,10 +153,12 @@ def test_fetch_pubchem_to_small_molecule_with_prefix(self):
142153
== "InChI=1S/C9H8O4/c1-6(10)13-8-5-3-2-4-7(8)9(11)12/h2-5H,1H3,(H,11,12)"
143154
)
144155

156+
@pytest.mark.remote
145157
def test_fetch_pubchem_to_small_molecule_invalid_id(self):
146158
with pytest.raises(ValueError):
147159
fetch_pubchem(cid="162176127617627")
148160

161+
@pytest.mark.remote
149162
def test_fetch_pdb_to_protein(self):
150163
protein = fetch_pdb("1a23")
151164
assert protein is not None
@@ -159,6 +172,7 @@ def test_fetch_pdb_to_protein(self):
159172
== "AQYEDGKQYTTLEKPVAGAPQVLEFFSFFCPHCYQFEEVLHISDNVKKKLPEGVKMTKYHVNFMGGDLGKDLTQAWAVAMALGVEDKVTVPLFEGVQKTQTIRSASDIRDVFINAGIKGEEYDAAWNSFVVKSLVAQQEKAAADVQLRGVPAMFVNGKYQLNPQGMDTSNMDVFVQQYADTVKYLSEKK"
160173
)
161174

175+
@pytest.mark.remote
162176
def test_fetch_pdb_to_protein_with_prefix(self):
163177
protein = fetch_pdb("pdb:1a23")
164178
assert protein is not None
@@ -172,6 +186,7 @@ def test_fetch_pdb_to_protein_with_prefix(self):
172186
== "AQYEDGKQYTTLEKPVAGAPQVLEFFSFFCPHCYQFEEVLHISDNVKKKLPEGVKMTKYHVNFMGGDLGKDLTQAWAVAMALGVEDKVTVPLFEGVQKTQTIRSASDIRDVFINAGIKGEEYDAAWNSFVVKSLVAQQEKAAADVQLRGVPAMFVNGKYQLNPQGMDTSNMDVFVQQYADTVKYLSEKK"
173187
)
174188

189+
@pytest.mark.remote
175190
def test_fetch_pdb_to_protein_invalid_id(self):
176191
with pytest.raises(ValueError):
177192
fetch_pdb("INVALID_ID")

0 commit comments

Comments
 (0)