summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordluyer <53582923+dluyer@users.noreply.github.com>2019-08-06 15:23:50 -0700
committerGitHub <noreply@github.com>2019-08-06 15:23:50 -0700
commit07831aea4ddec52240d790af31153b96ab454f05 (patch)
treec5b6c81cbab9e1cb82272349fe2c4c4a1da18aad /tests
parentaf9d9d91bb80d3c7783a0e6fe8d1bb67790e615a (diff)
downloadpexpect-git-07831aea4ddec52240d790af31153b96ab454f05.tar.gz
Fix test_which when sys.getfilesystemencoding() is ascii
Diffstat (limited to 'tests')
-rw-r--r--tests/test_which.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_which.py b/tests/test_which.py
index 15a8944..631db5a 100644
--- a/tests/test_which.py
+++ b/tests/test_which.py
@@ -2,6 +2,7 @@
import subprocess
import tempfile
import shutil
+import sys
import errno
import os
@@ -41,8 +42,12 @@ class TestCaseWhich(PexpectTestCase.PexpectTestCase):
" which() finds an executable in $PATH and returns its abspath. "
bin_dir = tempfile.mkdtemp()
+ if sys.getfilesystemencoding() == 'ascii':
+ prefix = 'ascii-'
+ else:
+ prefix = u'ǝpoɔıun-'
temp_obj = tempfile.NamedTemporaryFile(
- suffix=u'.sh', prefix=u'ǝpoɔıun-',
+ suffix=u'.sh', prefix=prefix,
dir=bin_dir, delete=False)
bin_path = temp_obj.name
fname = os.path.basename(temp_obj.name)