uga-libraries / format-report

Aggregate and analyze csv files with file format information generated by the UGA Libraries' digital preservation system (ARCHive).
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

Improve unit tests that print to the terminal #29

Open amhanson9 opened 1 year ago

amhanson9 commented 1 year ago

When unit tests print to the terminal, it prints the message among the result from unit tests, which can make it look like there was an error when that happened, and there is no testing that the correct message is printed. For these functions, there are other aspects of the test that indicate the logic is correct and would result in printing, so it isn't a high priority.

When time allows, try to keep the function from printing during unit tests and be able to test that it is printing the correct thing.

With update script: for script test_argument_error

With merge script: for read_row() test_aip_attribute_error and test_aip_value_error, for standardize_format() test_no_match, for script test_argument_error

With report script: for script test_missing_argument and test_missing_input

amhanson9 commented 1 year ago

See script unit test: can use assertRaises with subprocess if change to check=True to verify that it exited, as long as use sys.exit(1) instead of sys.exit(). This way does not print a message to the terminal, but if run it without check=True in order to test the printed message, it will also print the message during the test.