summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_cprofile.py13
-rw-r--r--Lib/test/test_profile.py13
2 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_cprofile.py b/Lib/test/test_cprofile.py
index 406d70305f..efcf6bc928 100644
--- a/Lib/test/test_cprofile.py
+++ b/Lib/test/test_cprofile.py
@@ -37,19 +37,6 @@ class CProfileTest(ProfileTest):
finally:
unlink(TESTFN)
- # Issue 21862
- def test_module_path_option(self):
- # Test -m switch with modules
-
- # Test that -m switch needs an argument
- assert_python_failure('-m', 'cProfile', '-m')
-
- # Test failure for not-existent module
- assert_python_failure('-m', 'cProfile', '-m', 'random_module_xyz')
-
- # Test successful run
- assert_python_ok('-m', 'cProfile', '-m', 'timeit', '-n', '1')
-
def test_profile_enable_disable(self):
prof = self.profilerclass()
# Make sure we clean ourselves up if the test fails for some reason.
diff --git a/Lib/test/test_profile.py b/Lib/test/test_profile.py
index a998266317..01a8a6eaf5 100644
--- a/Lib/test/test_profile.py
+++ b/Lib/test/test_profile.py
@@ -11,6 +11,7 @@ from contextlib import contextmanager
import profile
from test.profilee import testfunc, timer
+from test.support.script_helper import assert_python_failure, assert_python_ok
class ProfileTest(unittest.TestCase):
@@ -98,6 +99,18 @@ class ProfileTest(unittest.TestCase):
filename=TESTFN)
self.assertTrue(os.path.exists(TESTFN))
+ def test_run_profile_as_module(self):
+ # Test that -m switch needs an argument
+ assert_python_failure('-m', self.profilermodule.__name__, '-m')
+
+ # Test failure for not-existent module
+ assert_python_failure('-m', self.profilermodule.__name__,
+ '-m', 'random_module_xyz')
+
+ # Test successful run
+ assert_python_ok('-m', self.profilermodule.__name__,
+ '-m', 'timeit', '-n', '1')
+
def regenerate_expected_output(filename, cls):
filename = filename.rstrip('co')