Skip to content

Commit d82d33f

Browse files
author
Feras A. Saad
committed
Use python tempfile instead of hard-coded file in JSON test.
1 parent 78c4307 commit d82d33f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tests/test_core.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,8 @@ def test_json_ready_models():
694694
j = bdb.backends['cgpm'].json_ready_models(bdb, pop_id, gen_id)
695695
for m in j["models"]:
696696
assert len(m["clusters"]) > 0
697-
698697
# This is handy debugging code (lets you look at the model)
699-
# that can be enabled manually when needed
700-
if True:
701-
import json
702-
path = "/tmp/models.json"
703-
with open(path, 'w') as outfile:
704-
json.dump(j, outfile, indent=2)
698+
# that can be enabled manually when needed.
699+
with tempfile.NamedTemporaryFile(
700+
prefix='bayeslite-models', delete=False) as f:
701+
json.dump(j, f, indent=2)

0 commit comments

Comments
 (0)