Skip to content

Commit 226d78d

Browse files
committed
Requested test changes
1 parent 8f9b8a1 commit 226d78d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Lib/test/test_cprofile.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,17 @@ def test_sort(self):
156156
self.assertGreater(rc, 0)
157157
self.assertIn(b"option -s: invalid choice: 'demo'", err)
158158

159-
160-
class TestProfilingScript(unittest.TestCase):
161159
def test_profile_script_importing_main(self):
162160
"""Check that scripts that reference __main__ see their own namespace
163161
when being profiled."""
164-
with tempfile.NamedTemporaryFile("w+") as f:
162+
with tempfile.NamedTemporaryFile("w+", delete_on_close=False) as f:
165163
f.write(textwrap.dedent("""\
166164
class Foo:
167165
pass
168-
169166
import __main__
170167
assert Foo == __main__.Foo
171168
"""))
172-
f.flush()
169+
f.close()
173170
assert_python_ok('-m', "cProfile", f.name)
174171

175172

0 commit comments

Comments
 (0)