summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_history.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/test_history.py b/tests/test_history.py
index 09b83279..3a52bda9 100644
--- a/tests/test_history.py
+++ b/tests/test_history.py
@@ -459,18 +459,11 @@ def hist_file():
pass
def test_bad_history_file_path(capsys, request):
- # 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
+ with tempfile.TemporaryDirectory() as test_dir:
+ # Create a new cmd2 app
+ cmd2.Cmd(persistent_history_file=test_dir)
+ _, err = capsys.readouterr()
+ assert 'is a directory' in err
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