class TestBuilder(object):
def __init__(self, rootdir, workdir, selectors, exclude_selectors, annotate,
cleanup_workdir, cleanup_sharedlibs, with_pyregr, cython_only,
- languages, test_bugs):
+ languages, test_bugs, fork):
self.rootdir = rootdir
self.workdir = workdir
self.selectors = selectors
self.cython_only = cython_only
self.languages = languages
self.test_bugs = test_bugs
+ self.fork = fork
def build_suite(self):
suite = unittest.TestSuite()
annotate=self.annotate,
cleanup_workdir=self.cleanup_workdir,
cleanup_sharedlibs=self.cleanup_sharedlibs,
- cython_only=self.cython_only)
+ cython_only=self.cython_only,
+ fork=self.fork)
class CythonCompileTestCase(unittest.TestCase):
def __init__(self, directory, workdir, module, language='c',
expect_errors=False, annotate=False, cleanup_workdir=True,
- cleanup_sharedlibs=True, cython_only=False):
+ cleanup_sharedlibs=True, cython_only=False, fork=True):
self.directory = directory
self.workdir = workdir
self.module = module
self.cleanup_workdir = cleanup_workdir
self.cleanup_sharedlibs = cleanup_sharedlibs
self.cython_only = cython_only
+ self.fork = fork
unittest.TestCase.__init__(self)
def shortDescription(self):
pass
def run_doctests(self, module_name, result):
- if sys.version_info[0] >= 3 or not hasattr(os, 'fork'):
+ if sys.version_info[0] >= 3 or not hasattr(os, 'fork') or not self.fork:
doctest.DocTestSuite(module_name).run(result)
return
parser.add_option("--no-refnanny", dest="with_refnanny",
action="store_false", default=True,
help="do not regression test reference counting")
+ parser.add_option("--no-fork", dest="fork",
+ action="store_false", default=True,
+ help="do not fork to run tests")
parser.add_option("--sys-pyregr", dest="system_pyregr",
action="store_true", default=False,
help="run the regression tests of the CPython installation")
filetests = TestBuilder(ROOTDIR, WORKDIR, selectors, exclude_selectors,
options.annotate_source, options.cleanup_workdir,
options.cleanup_sharedlibs, options.pyregr,
- options.cython_only, languages, test_bugs)
+ options.cython_only, languages, test_bugs,
+ options.fork)
test_suite.addTest(filetests.build_suite())
if options.system_pyregr and languages:
filetests = TestBuilder(ROOTDIR, WORKDIR, selectors, exclude_selectors,
options.annotate_source, options.cleanup_workdir,
options.cleanup_sharedlibs, True,
- options.cython_only, languages, test_bugs)
+ options.cython_only, languages, test_bugs,
+ options.fork)
test_suite.addTest(
filetests.handle_directory(
os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test'),