def test_examples(self): """ Discover the example settings modules. """ # Limit the search to the test root to avoid having to mask out third-party modules, # such as hypothesis._settings. with mock.patch('sys.path', [TEST_ROOT]): self.assertEqual( list(utils.discover_candidate_settings()), [(TEST_ROOT, [ 'test_examples.error_settings', 'test_examples.likely_settings', 'test_examples.no_likely_settings', 'test_examples.no_settings', ])])
def test_dummy_path(self): """ Discover no candidates from an empty / dummy `sys.path`. """ paths = [ [], ['dummy'], ['foo', 'bar'], ] for path in paths: with self.subTest(path=path): with mock.patch('sys.path', path): self.assertEqual( list(utils.discover_candidate_settings()), [])