def test_discovery_of_module_by_python_path_outside_project(self): """HealthCheckLoader can scan locations outside working directory.""" original_dir = os.getcwd() try: # Move to a place that is not parent of # 'hospital.healthchecks.predictable'. os.chdir(os.path.dirname(__file__)) loader = HealthCheckLoader() suite = loader.discover('hospital') self.assertTrue(suite.countTestCases() > 0) finally: os.chdir(original_dir)
def test_discovery_of_module_by_python_path_in_stdlib(self): """HealthCheckLoader can scan locations in stdlib.""" for location in ['datetime', 'xml']: # A module and a package. loader = HealthCheckLoader() suite = loader.discover(location) self.assertEqual(suite.countTestCases(), 0)
def test_discovery_by_python_path(self): """HealthCheckLoader discovers healthchecks in Python packages.""" loader = HealthCheckLoader() suite = loader.discover('hospital.healthchecks.predictable') self.assertEqual(suite.countTestCases(), 2)