summaryrefslogtreecommitdiff
path: root/tests/test_history.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2019-05-25 14:32:36 -0600
committerkotfu <kotfu@kotfu.net>2019-05-25 14:32:36 -0600
commit0ed74c7ece6d69197b4e46fc37c0f3a440316392 (patch)
treec37f243c59ab8c846e6385e9a6be3c9f3b5456cf /tests/test_history.py
parent9b0a3c9315a0c3599a0ad06f9ea607a83af85cdb (diff)
downloadcmd2-git-0ed74c7ece6d69197b4e46fc37c0f3a440316392.tar.gz
Another try to fix the appveyor on windows permission issue
Diffstat (limited to 'tests/test_history.py')
-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