File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2360,6 +2360,21 @@ def test_startup_script(request):
2360
2360
assert 'alias create ls' in out [0 ]
2361
2361
2362
2362
2363
+ @pytest .mark .parametrize ('startup_script' , odd_file_names )
2364
+ def test_startup_script_with_odd_file_names (startup_script ):
2365
+ """Test file names with various patterns"""
2366
+ # Mock os.path.exists to trick cmd2 into adding this script to its startup commands
2367
+ saved_exists = os .path .exists
2368
+ os .path .exists = mock .MagicMock (name = 'exists' , return_value = True )
2369
+
2370
+ app = cmd2 .Cmd (allow_cli_args = False , startup_script = startup_script )
2371
+ assert len (app ._startup_commands ) == 1
2372
+ assert app ._startup_commands [0 ] == "run_script {}" .format (utils .quote_string (os .path .abspath (startup_script )))
2373
+
2374
+ # Restore os.path.exists
2375
+ os .path .exists = saved_exists
2376
+
2377
+
2363
2378
def test_transcripts_at_init ():
2364
2379
transcript_files = ['foo' , 'bar' ]
2365
2380
app = cmd2 .Cmd (allow_cli_args = False , transcript_files = transcript_files )
You can’t perform that action at this time.
0 commit comments