Skip to content

Commit cb96233

Browse files
Clean up files generated by tests (#316)
1 parent af730f4 commit cb96233

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: tests/test_jump.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def test_flag_large_events_withsnowball_noextension():
354354
assert cube[0, 2, 2, 2] == 0 # Saturation was NOT extended due to max_extended_radius=1
355355

356356

357-
def test_find_faint_extended():
357+
def test_find_faint_extended(tmp_path):
358358
nint, ngrps, ncols, nrows = 1, 66, 25, 25
359359
data = np.zeros(shape=(nint, ngrps, nrows, ncols), dtype=np.float32)
360360
gdq = np.zeros_like(data, dtype=np.uint32)
@@ -366,7 +366,7 @@ def test_find_faint_extended():
366366
rng = np.random.default_rng(12345)
367367
data[0, 1:, 14:20, 15:20] = 6 * gain * 6.0 * np.sqrt(2)
368368
data = data + rng.normal(size=(nint, ngrps, nrows, ncols)) * readnoise
369-
fits.writeto("data.fits", data, overwrite=True)
369+
fits.writeto(tmp_path / "data.fits", data, overwrite=True)
370370
gdq, num_showers = find_faint_extended(
371371
data,
372372
gdq,
@@ -386,7 +386,7 @@ def test_find_faint_extended():
386386
)
387387
# Check that all the expected samples in group 2 are flagged as jump and
388388
# that they are not flagged outside
389-
fits.writeto("gdq.fits", gdq, overwrite=True)
389+
fits.writeto(tmp_path / "gdq.fits", gdq, overwrite=True)
390390
# assert num_showers == 1
391391
assert np.all(gdq[0, 1, 22, 14:23] == 0)
392392
assert gdq[0, 1, 16, 18] == DQFLAGS['JUMP_DET']

Diff for: tests/test_tweakreg.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def datamodel(wcsobj2, group_id=None):
203203
return MinimalDataWithWCS(wcsobj2, group_id=group_id)
204204

205205

206-
def test_parse_refcat(datamodel):
206+
def test_parse_refcat(datamodel, tmp_path):
207207

208208
wcsobj = datamodel.meta.wcs
209209
correctors = fake_correctors(0.0)
@@ -216,11 +216,11 @@ def test_parse_refcat(datamodel):
216216
catalog=TEST_CATALOG)
217217

218218
# save refcat to file
219-
cat.write(Path.cwd() / CATALOG_FNAME, format="ascii.ecsv", overwrite=True)
219+
cat.write(tmp_path / CATALOG_FNAME, format="ascii.ecsv", overwrite=True)
220220

221221
# parse refcat from file
222222
epoch = Time(datamodel.meta.observation.date).decimalyear
223-
refcat = _parse_refcat(Path.cwd() / CATALOG_FNAME,
223+
refcat = _parse_refcat(tmp_path / CATALOG_FNAME,
224224
correctors,
225225
datamodel.meta.wcs,
226226
datamodel.meta.wcsinfo,

0 commit comments

Comments
 (0)