mjordan / islandora_workbench

A command-line tool for managing content in an Islandora 2 repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supress output from failed --check tests

mjordan opened this issue · comments

--check will output some useful text to the user if it finds a problem. It would be great to disable this output in tests. Here's an example of what happens now:

python3 tests/islandora_tests.py
...........Error: Row 2 of your CSV file has more columns (6) than there are headers (5).
....Error: Value in field "field_linked_agent" in row 1 (relatorsaut:1000) does not use the pattern required for typed relation fields.
.
----------------------------------------------------------------------
Ran 16 tests in 447.765s

OK

The tests pass, because they are testing --check's ability to find problems.

This is not a problem, it's just unsightly and ugly.

We can probably test check_input() on its own without running workbench (i.e, like a unit test). This would let us avoid the subprocess the tests currently use, providing direct control over the output.

tests/field_tests.py does this with log entries, but this doesn't apply to stdout:

        with self.assertLogs() as message:
           # test code that logs something
            self.assertRegex(str(message.output), 'simple_006 would exceed maximum number of allowed values.+2')