File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -459,16 +459,18 @@ def hist_file():
459459 pass
460460
461461def test_bad_history_file_path (capsys , request ):
462- with tempfile .TemporaryDirectory () as test_dir :
463- # For appveyor, create a directory in our temp dir
464- # for some reason it seems that appveyor won't let us read
465- # the directory we created
466- safe_dir = os .path .join (test_dir , 'somedir' )
467- os .mkdir (safe_dir )
468- # Create a new cmd2 app
469- cmd2 .Cmd (persistent_history_file = safe_dir )
470- _ , err = capsys .readouterr ()
471- assert 'is a directory' in err
462+ # can't use tempfile.TemporaryDirectory() as a context on Appveyor
463+ # on windows. it causes a file locking issue which is reflected as
464+ # a permission exception
465+ test_dir = tempfile .mkdtemp ()
466+ # Create a new cmd2 app
467+ cmd2 .Cmd (persistent_history_file = test_dir )
468+ _ , err = capsys .readouterr ()
469+ assert 'is a directory' in err
470+ try :
471+ os .rmdir (test_dir )
472+ except OSError :
473+ pass
472474
473475def test_history_file_conversion_no_truncate_on_init (hist_file , capsys ):
474476 # test the code that converts a plain text history file to a pickle binary
You can’t perform that action at this time.
0 commit comments