Skip to content

Commit 8cd3d5a

Browse files
authored
Merge pull request #371 from chinandrew/pytest
Make Delphi-Epidata tests Pytest compatible.
2 parents 3c7fbd8 + 6ba6c78 commit 8cd3d5a

39 files changed

+145
-9
lines changed

docs/epidata_development.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ The final line of output should be similar to the following:
143143
All 48 tests passed! 68% (490/711) coverage.
144144
```
145145

146+
You can also run tests using pytest like this:
147+
```
148+
docker run --rm delphi_python pytest repos/delphi/delphi-epidata/tests/
149+
```
150+
and with pdb enabled like this:
151+
```
152+
docker run -it --rm delphi_python pytest repos/delphi/delphi-epidata/tests/ --pdb
153+
```
154+
146155
## manual tests
147156

148157
You can test your changes manually by:
@@ -284,6 +293,15 @@ More concretely, you can run Epidata API integration tests like this:
284293
✔ All 3 tests passed! [coverage unavailable]
285294
```
286295

296+
You can also run tests using pytest like this:
297+
```
298+
docker run --network delphi-net --rm delphi_python pytest repos/delphi/delphi-epidata/integrations/
299+
```
300+
and with pdb enabled like this:
301+
```
302+
docker run --network delphi-net -it --rm delphi_python pytest repos/delphi/delphi-epidata/integrations/ --pdb
303+
```
304+
287305
5. Bring down the servers, for example with the `docker stop` command.
288306

289307
# rapid iteration

docs/new_endpoint_tutorial.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ If all succeeds, output should look like this:
267267
✔ All 48 tests passed! 69% (486/704) coverage.
268268
```
269269

270+
You can also run tests using pytest like this:
271+
```
272+
docker run --rm delphi_python pytest repos/delphi/delphi-epidata/tests/
273+
```
274+
and with pdb enabled like this:
275+
```
276+
docker run -it --rm delphi_python pytest repos/delphi/delphi-epidata/tests/ --pdb
277+
```
278+
270279
## integration
271280

272281
Integration tests require more effort and take longer to set up and run.
@@ -317,6 +326,14 @@ delphi.delphi-epidata.integrations.server.test_fluview_meta.FluviewMetaTests.tes
317326
318327
✔ All 16 tests passed! 48% (180/372) coverage.
319328
```
329+
You can also run tests using pytest like this:
330+
```
331+
docker run --network delphi-net --rm delphi_python pytest repos/delphi/delphi-epidata/integrations/
332+
```
333+
and with pdb enabled like this:
334+
```
335+
docker run --network delphi-net -it --rm delphi_python pytest repos/delphi/delphi-epidata/integrations/ --pdb
336+
```
320337

321338
# code review and submission
322339

integrations/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
import os
3+
4+
sys.path.append(os.getcwd())
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
import os
3+
4+
sys.path.append(os.getcwd())

integrations/acquisition/covid_hosp/facility/test_scenarios.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from delphi.epidata.acquisition.covid_hosp.common.database import Database
99
from delphi.epidata.acquisition.covid_hosp.common.test_utils import TestUtils
1010
from delphi.epidata.client.delphi_epidata import Epidata
11+
from delphi.epidata.acquisition.covid_hosp.facility.update import Update
1112
import delphi.operations.secrets as secrets
1213

1314
# py3tester coverage target (equivalent to `import *`)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
import os
3+
4+
sys.path.append(os.getcwd())

integrations/acquisition/covid_hosp/state_timeseries/test_scenarios.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from delphi.epidata.acquisition.covid_hosp.common.database import Database
99
from delphi.epidata.acquisition.covid_hosp.common.test_utils import TestUtils
1010
from delphi.epidata.client.delphi_epidata import Epidata
11+
from delphi.epidata.acquisition.covid_hosp.state_timeseries.update import Update
1112
import delphi.operations.secrets as secrets
1213

1314
# py3tester coverage target (equivalent to `import *`)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import sys
2+
import os
3+
4+
sys.path.append(os.getcwd())

integrations/acquisition/covidcast/test_covidcast_meta_caching.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from delphi.epidata.client.delphi_epidata import Epidata
1313
import delphi.operations.secrets as secrets
1414
import delphi.epidata.acquisition.covidcast.database as live
15+
from delphi.epidata.acquisition.covidcast.covidcast_meta_cache_updater import main
1516

1617
# py3tester coverage target (equivalent to `import *`)
1718
__test_target__ = (

integrations/acquisition/covidcast/test_csv_uploading.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
# first party
1313
from delphi.epidata.client.delphi_epidata import Epidata
14+
from delphi.epidata.acquisition.covidcast.csv_to_database import main
1415
import delphi.operations.secrets as secrets
1516

1617
# py3tester coverage target (equivalent to `import *`)

0 commit comments

Comments
 (0)