Python test.test_support.ResourceDenied() Examples
The following are 4
code examples of test.test_support.ResourceDenied().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
test.test_support
, or try the search function
.
Example #1
Source File: regrtest.py From BinderFilter with MIT License | 5 votes |
def runtest_inner(test, verbose, quiet, huntrleaks=False): test_support.unload(test) if verbose: capture_stdout = None else: capture_stdout = StringIO.StringIO() test_time = 0.0 refleak = False # True if the test leaked references. try: save_stdout = sys.stdout try: if capture_stdout: sys.stdout = capture_stdout if test.startswith('test.'): abstest = test else: # Always import it from the test package abstest = 'test.' + test with saved_test_environment(test, verbose, quiet) as environment: start_time = time.time() the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, test) # Old tests run to completion simply as a side-effect of # being imported. For tests based on unittest or doctest, # explicitly invoke their test_main() function (if it exists). indirect_test = getattr(the_module, "test_main", None) if indirect_test is not None: indirect_test() if huntrleaks: refleak = dash_R(the_module, test, indirect_test, huntrleaks) test_time = time.time() - start_time finally: sys.stdout = save_stdout except test_support.ResourceDenied, msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() return RESOURCE_DENIED, test_time
Example #2
Source File: regrtest.py From oss-ftp with MIT License | 5 votes |
def runtest_inner(test, verbose, quiet, huntrleaks=False): test_support.unload(test) if verbose: capture_stdout = None else: capture_stdout = StringIO.StringIO() test_time = 0.0 refleak = False # True if the test leaked references. try: save_stdout = sys.stdout try: if capture_stdout: sys.stdout = capture_stdout if test.startswith('test.'): abstest = test else: # Always import it from the test package abstest = 'test.' + test with saved_test_environment(test, verbose, quiet) as environment: start_time = time.time() the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, test) # Old tests run to completion simply as a side-effect of # being imported. For tests based on unittest or doctest, # explicitly invoke their test_main() function (if it exists). indirect_test = getattr(the_module, "test_main", None) if indirect_test is not None: indirect_test() if huntrleaks: refleak = dash_R(the_module, test, indirect_test, huntrleaks) test_time = time.time() - start_time finally: sys.stdout = save_stdout except test_support.ResourceDenied, msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() return RESOURCE_DENIED, test_time
Example #3
Source File: regrtest.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def runtest_inner(test, verbose, quiet, huntrleaks=False): test_support.unload(test) if verbose: capture_stdout = None else: capture_stdout = StringIO.StringIO() test_time = 0.0 refleak = False # True if the test leaked references. try: save_stdout = sys.stdout try: if capture_stdout: sys.stdout = capture_stdout if test.startswith('test.'): abstest = test else: # Always import it from the test package abstest = 'test.' + test with saved_test_environment(test, verbose, quiet) as environment: start_time = time.time() the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, test) # Old tests run to completion simply as a side-effect of # being imported. For tests based on unittest or doctest, # explicitly invoke their test_main() function (if it exists). indirect_test = getattr(the_module, "test_main", None) if indirect_test is not None: indirect_test() if huntrleaks: refleak = dash_R(the_module, test, indirect_test, huntrleaks) test_time = time.time() - start_time finally: sys.stdout = save_stdout except test_support.ResourceDenied, msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() return RESOURCE_DENIED, test_time
Example #4
Source File: regrtest.py From medicare-demo with Apache License 2.0 | 4 votes |
def runtest_inner(test, generate, verbose, quiet, testdir=None, huntrleaks=False, junit_xml_dir=None): test_support.unload(test) if not testdir: testdir = findtestdir() outputdir = os.path.join(testdir, "output") outputfile = os.path.join(outputdir, test) if verbose: cfp = None else: cfp = cStringIO.StringIO() try: save_stdout = sys.stdout if junit_xml_dir: from test.junit_xml import Tee, write_direct_test indirect_test = None save_stderr = sys.stderr sys.stdout = stdout = Tee(sys.stdout) sys.stderr = stderr = Tee(sys.stderr) try: if cfp: sys.stdout = cfp print test # Output file starts with test name if test.startswith('test.'): abstest = test else: # Always import it from the test package abstest = 'test.' + test start = time.time() the_package = __import__(abstest, globals(), locals(), []) the_module = getattr(the_package, test) # Most tests run to completion simply as a side-effect of # being imported. For the benefit of tests that can't run # that way (like test_threaded_import), explicitly invoke # their test_main() function (if it exists). indirect_test = getattr(the_module, "test_main", None) if indirect_test is not None: indirect_test() elif junit_xml_dir: write_direct_test(junit_xml_dir, abstest, time.time() - start, stdout=stdout.getvalue(), stderr=stderr.getvalue()) if huntrleaks: dash_R(the_module, test, indirect_test, huntrleaks) finally: sys.stdout = save_stdout if junit_xml_dir: sys.stderr = save_stderr except test_support.ResourceDenied, msg: if not quiet: print test, "skipped --", msg sys.stdout.flush() if junit_xml_dir: write_direct_test(junit_xml_dir, abstest, time.time() - start, 'skipped', sys.exc_info(), stdout=stdout.getvalue(), stderr=stderr.getvalue()) return -2