We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f9b8a1 commit 226d78dCopy full SHA for 226d78d
Lib/test/test_cprofile.py
@@ -156,20 +156,17 @@ def test_sort(self):
156
self.assertGreater(rc, 0)
157
self.assertIn(b"option -s: invalid choice: 'demo'", err)
158
159
-
160
-class TestProfilingScript(unittest.TestCase):
161
def test_profile_script_importing_main(self):
162
"""Check that scripts that reference __main__ see their own namespace
163
when being profiled."""
164
- with tempfile.NamedTemporaryFile("w+") as f:
+ with tempfile.NamedTemporaryFile("w+", delete_on_close=False) as f:
165
f.write(textwrap.dedent("""\
166
class Foo:
167
pass
168
169
import __main__
170
assert Foo == __main__.Foo
171
"""))
172
- f.flush()
+ f.close()
173
assert_python_ok('-m', "cProfile", f.name)
174
175
0 commit comments