diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-07-04 20:43:38 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-07-04 20:43:38 +0200 |
commit | 4e98c266b77d0629db2e313ab527b5180b16eaa9 (patch) | |
tree | 4cdb19c9b2afbe8314684c36e1f6180c319a5b9b | |
parent | 41b0d3045906abc982b8e85ef3a49354acfe7317 (diff) |
testconfig: Check the result of running the individual tests
Currently the tests might find issues with the documentation but
the exit code is still 0. This attemps to make the test_config
check the result of each test and then return if an error has
occurred. This should propagate all the way into a sys.exit()
call.
-rw-r--r-- | osmopy/osmotestconfig.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py index f9ebde0..8f9746d 100644 --- a/osmopy/osmotestconfig.py +++ b/osmopy/osmotestconfig.py @@ -27,12 +27,18 @@ import osmopy.osmoutil as osmoutil # Return true iff all the tests for the given config pass def test_config(app_desc, config, tmpdir, verbose=True): try: - test_config_atest(app_desc, config, verify_doc, verbose) + err = 0 + if test_config_atest(app_desc, config, verify_doc, verbose) > 0: + err += 1 newconfig = copy_config(tmpdir, config) - test_config_atest(app_desc, newconfig, write_config, verbose) - test_config_atest(app_desc, newconfig, token_vty_command, verbose) - return 0 + if test_config_atest(app_desc, newconfig, write_config, verbose) > 0: + err += 1 + + if test_config_atest(app_desc, newconfig, token_vty_command, verbose) > 0: + err += 1 + + return err # If there's a socket error, skip the rest of the tests for this config except IOError: @@ -93,7 +99,7 @@ def write_config(vty): # The only purpose of this function is to verify a working vty def token_vty_command(vty): vty.command("help") - return True + return 0 # This may warn about the same doc missing multiple times, by design |