@@ -2159,8 +2159,7 @@ def test_module_without_a_main(self):
2159
2159
stdout , stderr = self ._run_pdb (
2160
2160
['-m' , module_name ], "" , expected_returncode = 1
2161
2161
)
2162
- self .assertIn ("ImportError: No module named t_main.__main__" ,
2163
- stdout .splitlines ())
2162
+ self .assertIn ("ImportError: No module named t_main.__main__;" , stdout )
2164
2163
2165
2164
def test_package_without_a_main (self ):
2166
2165
pkg_name = 't_pkg'
@@ -2178,6 +2177,22 @@ def test_package_without_a_main(self):
2178
2177
"'t_pkg.t_main' is a package and cannot be directly executed" ,
2179
2178
stdout )
2180
2179
2180
+ def test_nonexistent_module (self ):
2181
+ assert not os .path .exists (os_helper .TESTFN )
2182
+ stdout , stderr = self ._run_pdb (["-m" , os_helper .TESTFN ], "" , expected_returncode = 1 )
2183
+ self .assertIn (f"ImportError: No module named { os_helper .TESTFN } " , stdout )
2184
+
2185
+ def test_dir_as_script (self ):
2186
+ with os_helper .temp_dir () as temp_dir :
2187
+ stdout , stderr = self ._run_pdb ([temp_dir ], "" , expected_returncode = 1 )
2188
+ self .assertIn (f"Error: { temp_dir } is a directory" , stdout )
2189
+
2190
+ def test_invalid_cmd_line_options (self ):
2191
+ stdout , stderr = self ._run_pdb (["-c" ], "" , expected_returncode = 1 )
2192
+ self .assertIn (f"Error: option -c requires argument" , stdout )
2193
+ stdout , stderr = self ._run_pdb (["--spam" ], "" , expected_returncode = 1 )
2194
+ self .assertIn (f"Error: option --spam not recognized" , stdout )
2195
+
2181
2196
def test_blocks_at_first_code_line (self ):
2182
2197
script = """
2183
2198
#This is a comment, on line 2
0 commit comments