Show More
@@ -15,6 +15,7 b' Tests for platutils.py' | |||
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import sys |
|
18 | import os | |
|
18 | 19 | from unittest import TestCase |
|
19 | 20 | |
|
20 | 21 | import nose.tools as nt |
@@ -24,13 +25,15 b' from IPython.utils.process import (find_cmd, FindCmdError, arg_split,' | |||
|
24 | 25 | from IPython.testing import decorators as dec |
|
25 | 26 | from IPython.testing import tools as tt |
|
26 | 27 | |
|
28 | python = os.path.basename(sys.executable) | |
|
29 | ||
|
27 | 30 | #----------------------------------------------------------------------------- |
|
28 | 31 | # Tests |
|
29 | 32 | #----------------------------------------------------------------------------- |
|
30 | 33 | |
|
31 | 34 | def test_find_cmd_python(): |
|
32 | 35 | """Make sure we find sys.exectable for python.""" |
|
33 |
nt.assert_equal(find_cmd( |
|
|
36 | nt.assert_equal(find_cmd(python), sys.executable) | |
|
34 | 37 | |
|
35 | 38 | |
|
36 | 39 | @dec.skip_win32 |
@@ -102,15 +105,15 b' class SubProcessTestCase(TestCase, tt.TempFileMixin):' | |||
|
102 | 105 | self.mktmp('\n'.join(lines)) |
|
103 | 106 | |
|
104 | 107 | def test_system(self): |
|
105 |
status = system(' |
|
|
108 | status = system('%s "%s"' % (python, self.fname)) | |
|
106 | 109 | self.assertEqual(status, 0) |
|
107 | 110 | |
|
108 | 111 | def test_system_quotes(self): |
|
109 |
status = system(' |
|
|
112 | status = system('%s -c "import sys"' % python) | |
|
110 | 113 | self.assertEqual(status, 0) |
|
111 | 114 | |
|
112 | 115 | def test_getoutput(self): |
|
113 |
out = getoutput(' |
|
|
116 | out = getoutput('%s "%s"' % (python, self.fname)) | |
|
114 | 117 | # we can't rely on the order the line buffered streams are flushed |
|
115 | 118 | try: |
|
116 | 119 | self.assertEqual(out, 'on stderron stdout') |
@@ -118,18 +121,18 b' class SubProcessTestCase(TestCase, tt.TempFileMixin):' | |||
|
118 | 121 | self.assertEqual(out, 'on stdouton stderr') |
|
119 | 122 | |
|
120 | 123 | def test_getoutput_quoted(self): |
|
121 |
out = getoutput(' |
|
|
124 | out = getoutput('%s -c "print (1)"' % python) | |
|
122 | 125 | self.assertEqual(out.strip(), '1') |
|
123 | 126 | |
|
124 | 127 | #Invalid quoting on windows |
|
125 | 128 | @dec.skip_win32 |
|
126 | 129 | def test_getoutput_quoted2(self): |
|
127 |
out = getoutput(" |
|
|
130 | out = getoutput("%s -c 'print (1)'" % python) | |
|
128 | 131 | self.assertEqual(out.strip(), '1') |
|
129 |
out = getoutput(" |
|
|
132 | out = getoutput("%s -c 'print (\"1\")'" % python) | |
|
130 | 133 | self.assertEqual(out.strip(), '1') |
|
131 | 134 | |
|
132 | 135 | def test_getoutput_error(self): |
|
133 |
out, err = getoutputerror(' |
|
|
136 | out, err = getoutputerror('%s "%s"' % (python, self.fname)) | |
|
134 | 137 | self.assertEqual(out, 'on stdout') |
|
135 | 138 | self.assertEqual(err, 'on stderr') |
General Comments 0
You need to be logged in to leave comments.
Login now