diff options
| author | William S Fulton <wsf@fultondesigns.co.uk> | 2018-12-05 19:43:13 +0000 |
|---|---|---|
| committer | William S Fulton <wsf@fultondesigns.co.uk> | 2018-12-06 06:50:57 +0000 |
| commit | ff93f2e26ee2b4999f62f576bd69604f75bcb2ba (patch) | |
| tree | 864b0cfe51daeadcfeb8fe440c448f8a6839decd /Examples/python/import_packages/same_modnames1/runme.py | |
| parent | 8d6f3010ea973f6debf81a046dbe4ed0aac5c7cf (diff) | |
| download | swig-ff93f2e26ee2b4999f62f576bd69604f75bcb2ba.tar.gz | |
Skip Python subprocess calls in import_packages testcase on Windows
Getting these kind of errors on Appveyor which uses mingw/cygwin to run
a Python interpreter:
Native windows Python 3.6 running under cygwin and mingw Python 3.7 running under mingw:
Fatal Python error: _Py_HashRandomization_Init: failed to get random
numbers to initialize Python
Cygwin Python 2.7 running under cygwin:
0 [main] python2.7 496 child_info_fork::abort: address space needed by '_foo.dll' (0x6D0000)
is already occupied
Diffstat (limited to 'Examples/python/import_packages/same_modnames1/runme.py')
| -rw-r--r-- | Examples/python/import_packages/same_modnames1/runme.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py index a3a579a17..a64551bfd 100644 --- a/Examples/python/import_packages/same_modnames1/runme.py +++ b/Examples/python/import_packages/same_modnames1/runme.py @@ -2,6 +2,12 @@ import os.path import subprocess import sys +def run_except_on_windows(commandline, env=None): + if os.name != "nt" and sys.platform != "cygwin": + # Strange failures on windows/cygin/mingw + subprocess.check_call(commandline, env=env, shell=True) + print(" Finished running: " + commandline) + # Test import of same modules from different packages testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" @@ -17,5 +23,4 @@ if classname.find("pkg2.foo.Pkg2_Foo") == -1: print " Successfully created object pkg2.foo.Pkg2_Foo" commandline = sys.executable + " -m pkg2.foo" -subprocess.check_call(commandline, shell=True) -print(" Finished running: " + commandline) +run_except_on_windows(commandline) |
