Skip to content

Commit a2c7709

Browse files
committed
Fix daily archive differ removing None files
1 parent 723b75c commit a2c7709

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

nchs_mortality/delphi_nchs_mortality/archive_diffs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def arch_diffs(params, daily_arch_diff):
7979
remove(exported_file)
8080
for exported_file, diff_file in common_diffs.items():
8181
remove(exported_file)
82-
remove(diff_file)
82+
if diff_file is not None:
83+
remove(diff_file)
8384

8485
# Report failures: someone should probably look at them
8586
for exported_file in fails:

nchs_mortality/tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from os import listdir, remove
99
from os.path import join
10+
from shutil import copy
1011

1112
from delphi_utils import read_params
1213
from delphi_nchs_mortality.run import run_module
@@ -27,6 +28,9 @@ def run_as_module(date):
2728
if ".csv" in fname:
2829
remove(join("daily_cache", fname))
2930

31+
# Simulate the cache already being partially populated
32+
copy("test_data/weekly_202025_state_wip_deaths_covid_incidence_prop.csv", "daily_cache")
33+
3034
for fname in listdir("daily_receiving"):
3135
if ".csv" in fname:
3236
remove(join("daily_receiving", fname))
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
geo_id,val,se,sample_size
2+
al,1.79475177,,
3+
ak,0.00000000,,
4+
az,2.80269167,,
5+
ar,1.49115052,,
6+
ca,1.14648064,,
7+
co,0.65986703,,
8+
ct,1.23412225,,
9+
dc,3.96741605,,
10+
fl,1.01500452,,
11+
ga,0.88533724,,
12+
hi,0.00000000,,
13+
id,0.00000000,,
14+
il,2.08336278,,
15+
in,1.63393378,,
16+
ia,1.01424057,,
17+
ks,0.68650341,,
18+
ky,0.58195844,,
19+
la,1.82843120,,
20+
md,2.21645868,,
21+
ma,1.88610726,,
22+
mi,0.57075014,,
23+
mn,1.18802079,,
24+
ms,2.40543506,,
25+
mo,0.68432575,,
26+
ne,1.18899426,,
27+
nv,0.64931773,,
28+
nh,0.95608552,,
29+
nj,1.81261604,,
30+
nm,1.19227653,,
31+
ny,1.10519612,,
32+
nc,0.95346300,,
33+
oh,0.89827275,,
34+
ok,0.45489340,,
35+
or,0.28451276,,
36+
pa,1.42165408,,
37+
ri,3.11508541,,
38+
sc,1.10707256,,
39+
sd,1.37854660,,
40+
tn,0.86394050,,
41+
tx,1.03462971,,
42+
ut,0.43668694,,
43+
va,1.01712904,,
44+
wa,0.40709699,,
45+
wi,0.63547307,,

0 commit comments

Comments
 (0)