summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_history.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/test_history.py b/tests/test_history.py
index 4ece9e0d..09b83279 100644
--- a/tests/test_history.py
+++ b/tests/test_history.py
@@ -459,16 +459,18 @@ def hist_file():
pass
def test_bad_history_file_path(capsys, request):
- with tempfile.TemporaryDirectory() as test_dir:
- # For appveyor, create a directory in our temp dir
- # for some reason it seems that appveyor won't let us read
- # the directory we created
- safe_dir = os.path.join(test_dir, 'somedir')
- os.mkdir(safe_dir)
- # Create a new cmd2 app
- cmd2.Cmd(persistent_history_file=safe_dir)
- _, err = capsys.readouterr()
- assert 'is a directory' in err
+ # can't use tempfile.TemporaryDirectory() as a context on Appveyor
+ # on windows. it causes a file locking issue which is reflected as
+ # a permission exception
+ test_dir = tempfile.mkdtemp()
+ # Create a new cmd2 app
+ cmd2.Cmd(persistent_history_file=test_dir)
+ _, err = capsys.readouterr()
+ assert 'is a directory' in err
+ try:
+ os.rmdir(test_dir)
+ except OSError:
+ pass
def test_history_file_conversion_no_truncate_on_init(hist_file, capsys):
# test the code that converts a plain text history file to a pickle binary