def assert_configs_for(glb, expected): result = set(executor.find_configurations(directory, glb)) expected = set(expected) if result != expected: print('Got ============>') print(sorted(result)) print('Expected ---------->') print(sorted(expected)) self.assertEqual(result, expected)
except BadConfiguration as error: errors = error.kwargs["parse_errors"] if not errors: assert False, "Ummm, errors shouldn't be None here" self.assertEqual(set(errors.keys()), set([conf1, conf3])) for val in errors.values(): assert isinstance(val, InvalidConfiguration) self.assertEqual(val.message, "Couldn't parse the yaml") describe TestCase, "Finding the configuration": it "complains if it can't find any configuration": with self.fuzzyAssertRaisesError(NoConfiguration): with a_directory() as directory: executor.find_configurations(directory, "*.yaml") it "finds all the files that match the glob": with a_directory() as directory: child = os.path.join(directory, "child") grandchild = os.path.join(child, "grandchild") greatgrandchild = os.path.join(grandchild, "greatgrandchild") child2 = os.path.join(directory, "child2") grandchild2 = os.path.join(child2, "grandchild2") os.makedirs(grandchild) os.makedirs(grandchild2) os.makedirs(greatgrandchild) conf1 = os.path.join(child, "conf1.yaml")