From a7f5d93bb6906d0f999248b47295d3a59b130f4d Mon Sep 17 00:00:00 2001 From: Hai Shi Date: Tue, 4 Aug 2020 00:41:24 +0800 Subject: bpo-40275: Use new test.support helper submodules in tests (GH-21449) --- Lib/test/test_tracemalloc.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Lib/test/test_tracemalloc.py') diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py index c5ae4e6d653..a0037f81b88 100644 --- a/Lib/test/test_tracemalloc.py +++ b/Lib/test/test_tracemalloc.py @@ -7,6 +7,7 @@ from unittest.mock import patch from test.support.script_helper import (assert_python_ok, assert_python_failure, interpreter_requires_environment) from test import support +from test.support import os_helper try: import _testcapi @@ -287,11 +288,11 @@ class TestTracemallocEnabled(unittest.TestCase): self.assertGreater(snapshot.traces[1].traceback.total_nframe, 10) # write on disk - snapshot.dump(support.TESTFN) - self.addCleanup(support.unlink, support.TESTFN) + snapshot.dump(os_helper.TESTFN) + self.addCleanup(os_helper.unlink, os_helper.TESTFN) # load from disk - snapshot2 = tracemalloc.Snapshot.load(support.TESTFN) + snapshot2 = tracemalloc.Snapshot.load(os_helper.TESTFN) self.assertEqual(snapshot2.traces, snapshot.traces) # tracemalloc must be tracing memory allocations to take a snapshot @@ -306,11 +307,11 @@ class TestTracemallocEnabled(unittest.TestCase): # take a snapshot with a new attribute snapshot = tracemalloc.take_snapshot() snapshot.test_attr = "new" - snapshot.dump(support.TESTFN) - self.addCleanup(support.unlink, support.TESTFN) + snapshot.dump(os_helper.TESTFN) + self.addCleanup(os_helper.unlink, os_helper.TESTFN) # load() should recreate the attribute - snapshot2 = tracemalloc.Snapshot.load(support.TESTFN) + snapshot2 = tracemalloc.Snapshot.load(os_helper.TESTFN) self.assertEqual(snapshot2.test_attr, "new") def fork_child(self): -- cgit v1.2.3