Skip to content

Commit

Permalink
Merge pull request #8611 from cfpb/fix/ruff
Browse files Browse the repository at this point in the history
Fix SIM115 by using a context manager
  • Loading branch information
willbarton authored Oct 21, 2024
2 parents 2efe7ad + bdf5712 commit 9bf0093
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cfgov/v1/tests/management/commands/test_publish_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9bf0093

Please sign in to comment.