Assertions about data in infrastructure code as unit tests
This is an interesting code. 



Criticism:


def testConfigStackYaml(self):




Can we rename these functions to snake_case such as test_config_stack_yaml maybe.



assert not bad_list, "Expected config/&lt;stack_name&gt;.yaml files to exist: %s" % bad_list




You can access unit test asserts from `TestCas
How:


self.assertTrue(expr, msg=None)
self.assertFalse(expr, msg=None)

More information at: https://docs.python.org/3.6/library/unittest.html#unittest.TestCase.assertTrue



expected_file = "%s/config/%s.yaml" % (stack_name, stack_name)




I personally like using the new formatter. % is more unreadable compared to
"{stack_name}/config/{stack_name}".format(stack_name=stack_name)
We can also use os.path.join to join sections of a path. This makes our intention clear.



if __name__ == "__main__":
    unittest.main()




If you add this to the end of the file you can run these test files individually as a simple script.




Creating a custom assert


I recommend creating a memeber function named assert_config_exists.
Parameters: path_format, message_format


def assert_config_exists(self, path_format: str, message_format: str):
    bad_list = []
    for stack in glob('*/config'):

        stack_name = os.path.dirname(stack)
        expected_file = path_format.format(stack_name=stack_name)

        if not os.path.isfile(expected_file):
            bad_list.append(expected_file)

    self.assertFalse(bad_list, message_format.format(bad_list=bad_list))
```