diff --git a/cfgov/v1/tests/management/commands/test_publish_pages.py b/cfgov/v1/tests/management/commands/test_publish_pages.py index 50049d01b0..5981a5c793 100644 --- a/cfgov/v1/tests/management/commands/test_publish_pages.py +++ b/cfgov/v1/tests/management/commands/test_publish_pages.py @@ -30,10 +30,10 @@ def make_page_with_draft_revision(self, slug): @contextmanager def make_tempfile(self, content): - tf = tempfile.NamedTemporaryFile() - tf.write(content) - tf.seek(0) - yield tf + with tempfile.NamedTemporaryFile() as tf: + tf.write(content) + tf.seek(0) + yield tf def test_dry_run(self): with self.make_tempfile(b"/a/\n/b/\n/c/\n") as tf: