MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / run_tests

Method run_tests

_pydev_runfiles/pydev_runfiles.py:755–817  ·  view source on GitHub ↗

runs all tests

(self, handle_coverage=True)

Source from the content-addressed store, hash-verified

753 return 0
754
755 def run_tests(self, handle_coverage=True):
756 """runs all tests"""
757 sys.stdout.write("Finding files... ")
758 files = self.find_import_files()
759 if self.verbosity > 3:
760 sys.stdout.write("%s ... done.\n" % (self.files_or_dirs))
761 else:
762 sys.stdout.write("done.\n")
763 sys.stdout.write("Importing test modules ... ")
764
765 if self.configuration.django:
766 import django
767
768 if hasattr(django, "setup"):
769 django.setup()
770
771 if handle_coverage:
772 coverage_files, coverage = start_coverage_support(self.configuration)
773
774 file_and_modules_and_module_name = self.find_modules_from_files(files)
775 sys.stdout.write("done.\n")
776
777 all_tests = self.find_tests_from_modules(file_and_modules_and_module_name)
778 all_tests = self.filter_tests(all_tests)
779
780 from _pydev_runfiles import pydev_runfiles_unittest
781
782 test_suite = pydev_runfiles_unittest.PydevTestSuite(all_tests)
783 from _pydev_runfiles import pydev_runfiles_xml_rpc
784
785 pydev_runfiles_xml_rpc.notifyTestsCollected(test_suite.countTestCases())
786
787 start_time = time.time()
788
789 def run_tests():
790 executed_in_parallel = False
791 if self.jobs > 1:
792 from _pydev_runfiles import pydev_runfiles_parallel
793
794 # What may happen is that the number of jobs needed is lower than the number of jobs requested
795 # (e.g.: 2 jobs were requested for running 1 test) -- in which case execute_tests_in_parallel will
796 # return False and won't run any tests.
797 executed_in_parallel = pydev_runfiles_parallel.execute_tests_in_parallel(
798 all_tests, self.jobs, self.split_jobs, self.verbosity, coverage_files, self.configuration.coverage_include
799 )
800
801 if not executed_in_parallel:
802 # If in coverage, we don't need to pass anything here (coverage is already enabled for this execution).
803 runner = pydev_runfiles_unittest.PydevTextTestRunner(stream=sys.stdout, descriptions=1, verbosity=self.verbosity)
804 sys.stdout.write("\n")
805 runner.run(test_suite)
806
807 if self.configuration.django:
808 get_django_test_suite_runner()(run_tests).run_tests([])
809 else:
810 run_tests()
811
812 if handle_coverage:

Callers 3

run_clientFunction · 0.95
mainFunction · 0.45

Calls 11

find_import_filesMethod · 0.95
filter_testsMethod · 0.95
start_coverage_supportFunction · 0.90
writeMethod · 0.45
notifyTestsCollectedMethod · 0.45
runMethod · 0.45
stopMethod · 0.45
notifyTestRunFinishedMethod · 0.45

Tested by 1