@@ -2820,8 +2820,7 @@ def test_module_without_a_main(self):
28202820 stdout , stderr = self ._run_pdb (
28212821 ['-m' , module_name ], "" , expected_returncode = 1
28222822 )
2823- self .assertIn ("ImportError: No module named t_main.__main__" ,
2824- stdout .splitlines ())
2823+ self .assertIn ("ImportError: No module named t_main.__main__;" , stdout )
28252824
28262825 def test_package_without_a_main (self ):
28272826 pkg_name = 't_pkg'
@@ -2839,6 +2838,22 @@ def test_package_without_a_main(self):
28392838 "'t_pkg.t_main' is a package and cannot be directly executed" ,
28402839 stdout )
28412840
2841+ def test_nonexistent_module (self ):
2842+ assert not os .path .exists (os_helper .TESTFN )
2843+ stdout , stderr = self ._run_pdb (["-m" , os_helper .TESTFN ], "" , expected_returncode = 1 )
2844+ self .assertIn (f"ImportError: No module named { os_helper .TESTFN } " , stdout )
2845+
2846+ def test_dir_as_script (self ):
2847+ with os_helper .temp_dir () as temp_dir :
2848+ stdout , stderr = self ._run_pdb ([temp_dir ], "" , expected_returncode = 1 )
2849+ self .assertIn (f"Error: { temp_dir } is a directory" , stdout )
2850+
2851+ def test_invalid_cmd_line_options (self ):
2852+ stdout , stderr = self ._run_pdb (["-c" ], "" , expected_returncode = 2 )
2853+ self .assertIn (f"pdb: error: argument -c/--command: expected one argument" , stdout .split ('\n ' )[1 ])
2854+ stdout , stderr = self ._run_pdb (["--spam" , "-m" , "pdb" ], "" , expected_returncode = 2 )
2855+ self .assertIn (f"pdb: error: unrecognized arguments: --spam" , stdout .split ('\n ' )[1 ])
2856+
28422857 def test_blocks_at_first_code_line (self ):
28432858 script = """
28442859 #This is a comment, on line 2
0 commit comments