diff options
Diffstat (limited to 'Lib/test/test_cprofile.py')
-rw-r--r-- | Lib/test/test_cprofile.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_cprofile.py b/Lib/test/test_cprofile.py index 53f8917330..1430d22504 100644 --- a/Lib/test/test_cprofile.py +++ b/Lib/test/test_cprofile.py @@ -6,6 +6,7 @@ from test.support import run_unittest, TESTFN, unlink # rip off all interesting stuff from test_profile import cProfile from test.test_profile import ProfileTest, regenerate_expected_output +from test.support.script_helper import assert_python_failure, assert_python_ok class CProfileTest(ProfileTest): @@ -35,6 +36,19 @@ 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_main(): run_unittest(CProfileTest) |