summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <thomas@kluyver.me.uk>2019-08-07 09:42:06 +0100
committerGitHub <noreply@github.com>2019-08-07 09:42:06 +0100
commit3eb30cfdef94e810d5b96f8fae758ea0cc25aaed (patch)
treea6f6e2543688c52c56cb736253ef8ff6d0c1e9c0
parente77d70510f05a204b06da2b821ebd5b667b11e75 (diff)
parent93c1f1bc2d98b8fc0632ba7d10649e51a9f96434 (diff)
downloadpexpect-3eb30cfdef94e810d5b96f8fae758ea0cc25aaed.tar.gz
Merge pull request #585 from dluyer/patch-8
Fix test_which when sys.getfilesystemencoding() is ascii
-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..e1b19a8 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() in ('ascii', 'ANSI_X3.4-1968'):
+ 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)