Changes which allow the tests to run on windows in ipython qtconsole
This commit is contained in:
parent
4d7d665a82
commit
3d5468a9e2
1 changed files with 14 additions and 5 deletions
|
|
@ -589,6 +589,12 @@ tests.append(TestTargetMachines)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class TestNative(unittest.TestCase):
|
class TestNative(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.tmpdir = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
shutil.rmtree(self.tmpdir)
|
||||||
|
|
||||||
|
|
||||||
def _make_module(self):
|
def _make_module(self):
|
||||||
m = Module.new('module1')
|
m = Module.new('module1')
|
||||||
|
|
@ -603,7 +609,7 @@ class TestNative(unittest.TestCase):
|
||||||
return m
|
return m
|
||||||
|
|
||||||
def _compile(self, src):
|
def _compile(self, src):
|
||||||
dst = '/tmp/llvmobj.out'
|
dst = os.path.join(self.tmpdir, 'llvmobj.out')
|
||||||
s = subprocess.call(['cc', '-o', dst, src])
|
s = subprocess.call(['cc', '-o', dst, src])
|
||||||
if s != 0:
|
if s != 0:
|
||||||
raise Exception("Cannot compile")
|
raise Exception("Cannot compile")
|
||||||
|
|
@ -615,7 +621,7 @@ class TestNative(unittest.TestCase):
|
||||||
m = self._make_module()
|
m = self._make_module()
|
||||||
output = m.to_native_assembly()
|
output = m.to_native_assembly()
|
||||||
|
|
||||||
src = '/tmp/llvmasm.s'
|
src = os.path.join(self.tmpdir, 'llvmasm.s')
|
||||||
with open(src, 'wb') as fout:
|
with open(src, 'wb') as fout:
|
||||||
fout.write(output)
|
fout.write(output)
|
||||||
|
|
||||||
|
|
@ -625,12 +631,13 @@ class TestNative(unittest.TestCase):
|
||||||
m = self._make_module()
|
m = self._make_module()
|
||||||
output = m.to_native_object()
|
output = m.to_native_object()
|
||||||
|
|
||||||
src = '/tmp/llvmobj.o'
|
src = os.path.join(self.tmpdir, 'llvmobj.o')
|
||||||
with open(src, 'wb') as fout:
|
with open(src, 'wb') as fout:
|
||||||
fout.write(output)
|
fout.write(output)
|
||||||
|
|
||||||
self._compile(src)
|
self._compile(src)
|
||||||
|
|
||||||
|
if sys.platform != 'win32':
|
||||||
tests.append(TestNative)
|
tests.append(TestNative)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
@ -954,7 +961,9 @@ def run(verbosity=1):
|
||||||
for cls in tests:
|
for cls in tests:
|
||||||
suite.addTest(unittest.makeSuite(cls))
|
suite.addTest(unittest.makeSuite(cls))
|
||||||
|
|
||||||
runner = unittest.TextTestRunner(verbosity=verbosity)
|
# The default stream fails in IPython qtconsole on Windows,
|
||||||
|
# so just using sys.stdout
|
||||||
|
runner = unittest.TextTestRunner(verbosity=verbosity, stream=sys.stdout)
|
||||||
return runner.run(suite)
|
return runner.run(suite)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue