Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move addCleanup call to tempfile
  • Loading branch information
donbarbos committed Mar 15, 2025
commit 3292d1e954c0ea1bac511a542e40c1df838e9629
4 changes: 2 additions & 2 deletions Lib/test/test_pickletools.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ def check_output(self, data, expect, *flags):
def test_invocation(self):
# test various combinations of parameters
output_file = tempfile.mktemp()
self.addCleanup(os_helper.unlink, output_file)
base_flags = [
(f'-o={output_file}', f'--output={output_file}'),
('-m', '--memo'),
Expand All @@ -569,7 +570,6 @@ def test_invocation(self):
for args in itertools.product(*choices):
with self.subTest(args=args[1:]):
_ = self.invoke_pickletools(*args)
self.addCleanup(os_helper.unlink, output_file)

with self.assertRaises(SystemExit):
# suppress argparse error message
Expand All @@ -579,6 +579,7 @@ def test_invocation(self):
def test_output_flag(self):
# test 'python -m pickletools -o/--output'
output_file = tempfile.mktemp()
self.addCleanup(os_helper.unlink, output_file)
data = ("fake_data",)
expect = '''
0: \\x80 PROTO 5
Expand All @@ -601,7 +602,6 @@ def test_output_flag(self):
self.assertListEqual(res.splitlines(), [])
self.assertListEqual(res_from_file.splitlines(),
expect.splitlines())
self.addCleanup(os_helper.unlink, output_file)

def test_memo_flag(self):
# test 'python -m pickletools -m/--memo'
Expand Down