|
9 | 9 | from conftest import TEST_DIR
|
10 | 10 |
|
11 | 11 | class TestRun:
|
12 |
| - def test_output_files_exist(self): |
13 |
| - output_files = listdir("receiving") |
| 12 | + @classmethod |
| 13 | + def teardown_class(cls): |
| 14 | + print('cleaning up tests...') |
| 15 | + shutil.rmtree(f"{TEST_DIR}/receiving/") |
| 16 | + def test_output_files_exist(self, run_as_module): |
| 17 | + output_files = listdir(f"{TEST_DIR}/receiving") |
14 | 18 | smoothed_files = sorted(list(set([file for file in output_files if "smoothed" in file])))
|
15 | 19 | raw_files = sorted(list(set([file for file in output_files if "raw" in file])))
|
16 | 20 | csv_files = {"raw": raw_files, "smoothed": smoothed_files}
|
@@ -62,11 +66,10 @@ def test_output_files_exist(self):
|
62 | 66 | csv_dates = list(set([datetime.strptime(f.split('_')[0], "%Y%m%d") for f in csv_files[smther] if smther in f]))
|
63 | 67 | assert set(csv_files[smther]).issuperset(set(expected_files))
|
64 | 68 |
|
65 |
| - shutil.rmtree(f"{TEST_DIR}/receiving/") |
66 | 69 |
|
67 |
| - def test_output_file_format(self, run_as_module): |
| 70 | + def test_output_file_format(self): |
68 | 71 | df = pd.read_csv(
|
69 |
| - join("receiving", "20200810_state_s03_smoothed_search.csv") |
| 72 | + join(f"{TEST_DIR}/receiving", "20200810_state_s03_smoothed_search.csv") |
70 | 73 | )
|
71 | 74 | assert (df.columns.values == [
|
72 | 75 | "geo_id", "val", "se", "sample_size"]).all()
|
0 commit comments