summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2015-09-22 14:57:40 +0100
committerThomas Kluyver <takowl@gmail.com>2015-09-22 14:57:40 +0100
commitcdcb7e69d5f82d81bdeefda05322167f1f92aaab (patch)
tree889e64c775288aa9cf4459bf640aeaa0165e45ae
parenta8e0b19beb06500c5d92597a4a5b4e4e58ecc85b (diff)
parentc0fea0709bf21aba6ecf8fb647b4e48a89b3fcbb (diff)
downloadpexpect-cdcb7e69d5f82d81bdeefda05322167f1f92aaab.tar.gz
Merge pull request #265 from pexpect/unicode-argv
Unicode argv tests
-rw-r--r--tests/test_unicode.py9
-rw-r--r--tests/test_which.py9
2 files changed, 16 insertions, 2 deletions
diff --git a/tests/test_unicode.py b/tests/test_unicode.py
index f342bf9..55632c3 100644
--- a/tests/test_unicode.py
+++ b/tests/test_unicode.py
@@ -173,6 +173,15 @@ class UnicodeTests(PexpectTestCase.PexpectTestCase):
# exercise,
assert child.readline() == 'input' + child.crlf
+ def test_unicode_argv(self):
+ """ Ensure a program can be executed with unicode arguments. """
+ p = pexpect.spawn(u'echo ǝpoɔıun'.format(self=self),
+ timeout=5, encoding='utf8')
+ p.expect(u'ǝpoɔıun')
+ p.expect(pexpect.EOF)
+ assert not p.isalive()
+ assert p.exitstatus == 0
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_which.py b/tests/test_which.py
index bda3333..f909214 100644
--- a/tests/test_which.py
+++ b/tests/test_which.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import subprocess
import tempfile
import shutil
@@ -21,9 +22,13 @@ class TestCaseWhich(PexpectTestCase.PexpectTestCase):
def test_os_defpath_which(self):
" which() finds an executable in $PATH and returns its abspath. "
- fname = 'cc'
+
bin_dir = tempfile.mkdtemp()
- bin_path = os.path.join(bin_dir, fname)
+ temp_obj = tempfile.NamedTemporaryFile(
+ suffix=u'.sh', prefix=u'ǝpoɔıun-',
+ dir=bin_dir, delete=False)
+ bin_path = temp_obj.name
+ fname = os.path.basename(temp_obj.name)
save_path = os.environ['PATH']
save_defpath = os.defpath