| LEFT | RIGHT |
| (no file at all) | |
| 1 # Run the _testcapi module tests (tests for the Python/C API): by defn, | 1 # Run the _testcapi module tests (tests for the Python/C API): by defn, |
| 2 # these are all functions _testcapi exports whose name begins with 'test_'. | 2 # these are all functions _testcapi exports whose name begins with 'test_'. |
| 3 | 3 |
| 4 from __future__ import with_statement | 4 from __future__ import with_statement |
| 5 import os | 5 import os |
| 6 import pickle | 6 import pickle |
| 7 import random | 7 import random |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 import time | 10 import time |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 def test(self): | 182 def test(self): |
| 183 self.assertEqual(_testcapi.argparsing("Hello", "World"), 1) | 183 self.assertEqual(_testcapi.argparsing("Hello", "World"), 1) |
| 184 | 184 |
| 185 | 185 |
| 186 class EmbeddingTest(unittest.TestCase): | 186 class EmbeddingTest(unittest.TestCase): |
| 187 | 187 |
| 188 @unittest.skipIf( | 188 @unittest.skipIf( |
| 189 sys.platform.startswith('win'), | 189 sys.platform.startswith('win'), |
| 190 "test doesn't work under Windows") | 190 "test doesn't work under Windows") |
| 191 def test_subinterps(self): | 191 def test_subinterps(self): |
| 192 # XXX only tested under Unix checkouts | 192 # XXX only tested under Posix checkouts |
| 193 basepath = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) | 193 basepath = support.SAVEDCWD |
| 194 oldcwd = os.getcwd() | 194 oldcwd = os.getcwd() |
| 195 # This is needed otherwise we get a fatal error: | 195 # This is needed otherwise we get a fatal error: |
| 196 # "Py_Initialize: Unable to get the locale encoding | 196 # "Py_Initialize: Unable to get the locale encoding |
| 197 # LookupError: no codec search functions registered: can't find encoding
" | 197 # LookupError: no codec search functions registered: can't find encoding
" |
| 198 os.chdir(basepath) | 198 os.chdir(basepath) |
| 199 try: | 199 try: |
| 200 exe = os.path.join(basepath, "Modules", "_testembed") | 200 # XXX to be replaced by packaging.util |
| 201 from distutils.spawn import find_executable |
| 202 exe = find_executable("_testembed", basepath) |
| 201 if not os.path.exists(exe): | 203 if not os.path.exists(exe): |
| 202 self.skipTest("%r doesn't exist" % exe) | 204 self.skipTest("%r doesn't exist" % exe) |
| 203 p = subprocess.Popen([exe], | 205 p = subprocess.Popen([exe], |
| 204 stdout=subprocess.PIPE, | 206 stdout=subprocess.PIPE, |
| 205 stderr=subprocess.PIPE) | 207 stderr=subprocess.PIPE) |
| 206 (out, err) = p.communicate() | 208 (out, err) = p.communicate() |
| 207 self.assertEqual(p.returncode, 0, | 209 self.assertEqual(p.returncode, 0, |
| 208 "bad returncode %d, stderr is %r" % | 210 "bad returncode %d, stderr is %r" % |
| 209 (p.returncode, err)) | 211 (p.returncode, err)) |
| 210 if support.verbose: | 212 if support.verbose: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if threading: | 248 if threading: |
| 247 import time | 249 import time |
| 248 TestThreadState() | 250 TestThreadState() |
| 249 t = threading.Thread(target=TestThreadState) | 251 t = threading.Thread(target=TestThreadState) |
| 250 t.start() | 252 t.start() |
| 251 t.join() | 253 t.join() |
| 252 | 254 |
| 253 | 255 |
| 254 if __name__ == "__main__": | 256 if __name__ == "__main__": |
| 255 test_main() | 257 test_main() |
| LEFT | RIGHT |