Commit e1e7b956 authored by gabrieldemarmiesse's avatar gabrieldemarmiesse

Added tests for the convolve with the memoryviews.

parent c2a3457a
...@@ -522,7 +522,9 @@ class TestBuilder(object): ...@@ -522,7 +522,9 @@ class TestBuilder(object):
cleanup_workdir, cleanup_sharedlibs, cleanup_failures, cleanup_workdir, cleanup_sharedlibs, cleanup_failures,
with_pyregr, cython_only, languages, test_bugs, fork, language_level, with_pyregr, cython_only, languages, test_bugs, fork, language_level,
test_determinism, test_determinism,
common_utility_dir, pythran_dir=None): common_utility_dir, pythran_dir=None,
default_mode='run',
add_embedded_test=True):
self.rootdir = rootdir self.rootdir = rootdir
self.workdir = workdir self.workdir = workdir
self.selectors = selectors self.selectors = selectors
...@@ -540,6 +542,8 @@ class TestBuilder(object): ...@@ -540,6 +542,8 @@ class TestBuilder(object):
self.test_determinism = test_determinism self.test_determinism = test_determinism
self.common_utility_dir = common_utility_dir self.common_utility_dir = common_utility_dir
self.pythran_dir = pythran_dir self.pythran_dir = pythran_dir
self.default_mode = default_mode
self.add_embedded_test = add_embedded_test
def build_suite(self): def build_suite(self):
suite = unittest.TestSuite() suite = unittest.TestSuite()
...@@ -554,7 +558,7 @@ class TestBuilder(object): ...@@ -554,7 +558,7 @@ class TestBuilder(object):
continue continue
suite.addTest( suite.addTest(
self.handle_directory(path, filename)) self.handle_directory(path, filename))
if sys.platform not in ['win32']: if sys.platform not in ['win32'] and self.add_embedded_test:
# Non-Windows makefile. # Non-Windows makefile.
if [1 for selector in self.selectors if selector("embedded")] \ if [1 for selector in self.selectors if selector("embedded")] \
and not [1 for selector in self.exclude_selectors if selector("embedded")]: and not [1 for selector in self.exclude_selectors if selector("embedded")]:
...@@ -589,7 +593,7 @@ class TestBuilder(object): ...@@ -589,7 +593,7 @@ class TestBuilder(object):
if match(fqmodule, tags)]: if match(fqmodule, tags)]:
continue continue
mode = 'run' # default mode = self.default_mode
if tags['mode']: if tags['mode']:
mode = tags['mode'][0] mode = tags['mode'][0]
elif context == 'pyregr': elif context == 'pyregr':
...@@ -610,8 +614,10 @@ class TestBuilder(object): ...@@ -610,8 +614,10 @@ class TestBuilder(object):
test_class = CythonUnitTestCase test_class = CythonUnitTestCase
else: else:
test_class = CythonRunTestCase test_class = CythonRunTestCase
else: elif mode in ['compile', 'error', 'test']:
test_class = CythonCompileTestCase test_class = CythonCompileTestCase
else:
raise KeyError('Invalid test mode: ' + mode)
for test in self.build_tests(test_class, path, workdir, for test in self.build_tests(test_class, path, workdir,
module, mode == 'error', tags): module, mode == 'error', tags):
...@@ -1802,6 +1808,9 @@ def main(): ...@@ -1802,6 +1808,9 @@ def main():
parser.add_option("--no-pyregr", dest="pyregr", parser.add_option("--no-pyregr", dest="pyregr",
action="store_false", default=True, action="store_false", default=True,
help="do not run the regression tests of CPython in tests/pyregr/") help="do not run the regression tests of CPython in tests/pyregr/")
parser.add_option("--no-examples", dest="examples",
action="store_false", default=True,
help="Do not run the documentation tests in the examples directory.")
parser.add_option("--cython-only", dest="cython_only", parser.add_option("--cython-only", dest="cython_only",
action="store_true", default=False, action="store_true", default=False,
help="only compile pyx to c, do not run C compiler or run the tests") help="only compile pyx to c, do not run C compiler or run the tests")
...@@ -1857,6 +1866,9 @@ def main(): ...@@ -1857,6 +1866,9 @@ def main():
help="stop on first failure or error") help="stop on first failure or error")
parser.add_option("--root-dir", dest="root_dir", default=os.path.join(DISTDIR, 'tests'), parser.add_option("--root-dir", dest="root_dir", default=os.path.join(DISTDIR, 'tests'),
help="working directory") help="working directory")
parser.add_option("--examples-dir", dest="examples_dir",
default=os.path.join(DISTDIR, 'docs', 'examples'),
help="working directory")
parser.add_option("--work-dir", dest="work_dir", default=os.path.join(os.getcwd(), 'TEST_TMP'), parser.add_option("--work-dir", dest="work_dir", default=os.path.join(os.getcwd(), 'TEST_TMP'),
help="working directory") help="working directory")
parser.add_option("--cython-dir", dest="cython_dir", default=os.getcwd(), parser.add_option("--cython-dir", dest="cython_dir", default=os.getcwd(),
...@@ -2130,6 +2142,18 @@ def runtests(options, cmd_args, coverage=None): ...@@ -2130,6 +2142,18 @@ def runtests(options, cmd_args, coverage=None):
options.test_determinism, options.test_determinism,
common_utility_dir, options.pythran_dir) common_utility_dir, options.pythran_dir)
test_suite.addTest(filetests.build_suite()) test_suite.addTest(filetests.build_suite())
if options.examples and languages:
filetests = TestBuilder(options.examples_dir, WORKDIR, selectors, exclude_selectors,
options.annotate_source, options.cleanup_workdir,
options.cleanup_sharedlibs, options.cleanup_failures,
options.pyregr,
options.cython_only, languages, test_bugs,
options.fork, options.language_level,
options.test_determinism,
common_utility_dir, options.pythran_dir,
default_mode='compile',
add_embedded_test=False)
test_suite.addTest(filetests.build_suite())
if options.system_pyregr and languages: if options.system_pyregr and languages:
sys_pyregr_dir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test') sys_pyregr_dir = os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment