From 475e9a085654252d5a274dab2118b746e8bda4eb Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Fri, 18 Feb 2011 18:30:11 -0300 Subject: [PATCH] fix inline textcase to not use default $HOME/.cython/inline --- Cython/Build/Tests/TestInline.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Cython/Build/Tests/TestInline.py b/Cython/Build/Tests/TestInline.py index b9ffade8..6fb259f5 100644 --- a/Cython/Build/Tests/TestInline.py +++ b/Cython/Build/Tests/TestInline.py @@ -1,3 +1,4 @@ +import os, tempfile from Cython.Shadow import inline from Cython.Build.Inline import safe_type from Cython.TestUtils import CythonTest @@ -13,23 +14,31 @@ test_kwds = dict(force=True, quiet=True) global_value = 100 class TestInline(CythonTest): + def setUp(self): + CythonTest.setUp(self) + self.test_kwds = dict(test_kwds) + if os.path.isdir('BUILD'): + lib_dir = os.path.join('BUILD','inline') + else: + lib_dir = tempfile.mkdtemp(prefix='cython_inline_') + self.test_kwds['lib_dir'] = lib_dir def test_simple(self): - self.assertEquals(inline("return 1+2", **test_kwds), 3) + self.assertEquals(inline("return 1+2", **self.test_kwds), 3) def test_types(self): self.assertEquals(inline(""" cimport cython return cython.typeof(a), cython.typeof(b) - """, a=1.0, b=[], **test_kwds), ('double', 'list object')) + """, a=1.0, b=[], **self.test_kwds), ('double', 'list object')) def test_locals(self): a = 1 b = 2 - self.assertEquals(inline("return a+b", **test_kwds), 3) + self.assertEquals(inline("return a+b", **self.test_kwds), 3) def test_globals(self): - self.assertEquals(inline("return global_value + 1", **test_kwds), global_value + 1) + self.assertEquals(inline("return global_value + 1", **self.test_kwds), global_value + 1) if has_numpy: @@ -38,4 +47,4 @@ class TestInline(CythonTest): a = numpy.ndarray((10, 20)) a[0,0] = 10 self.assertEquals(safe_type(a), 'numpy.ndarray[numpy.float64_t, ndim=2]') - self.assertEquals(inline("return a[0,0]", a=a, **test_kwds), 10.0) + self.assertEquals(inline("return a[0,0]", a=a, **self.test_kwds), 10.0) -- 2.26.2