I'm trying to make a testing system for continuous integration and I want to be able to have checks that do specific operations, like formatting files in a specific way, and those checks need to have a flow to them.
Example:
FormatFilesCheck(files):
Test(see if formatter is installed)
for prep in prework:
Test(do prep)
for file in files:
Test(try formatting file)
Test(clean up work)
I was wondering if there is a python library out there that handles test control. Obviously there is unittest but from what I can tell it's meant linear testing, i.e. testing with dependencies.
If unittest has this capability an example would be amazing.
*edit: What I'm really looking for is a framework with unittest like capabilities for error handling and assertions which allows me to write checks and have them plug into it.
Thanks ahead of time
If I'm understanding what you're asking, you're looking for something along the lines of Chai JS. Fortunately, someone has written a python library that approximates it, also called Chai. Your testcase would look something like this:
FormatFilesCheck(files):
expect(formatter.status).equals(installed)
for prep in prework:
do prep
expect(prep).equals(what_prep_should_look_like)
for file in files:
format file
expect(file).equals(what_file_should_look_like)
clean up work
# your expect/assert statements to make sure everything was cleaned up