From 83b4b6f6f0a75e2dcc55ec4b10e3ae36dc0bb519 Mon Sep 17 00:00:00 2001 From: David Huber Date: Tue, 16 Jul 2024 08:21:52 -0500 Subject: [PATCH] Check for NoneType after calling which; rename rocotostat to prevent nameclash with rocotostat module --- ci/scripts/tests/test_rocotostat.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ci/scripts/tests/test_rocotostat.py b/ci/scripts/tests/test_rocotostat.py index f43f8df2f8..a3c56df988 100755 --- a/ci/scripts/tests/test_rocotostat.py +++ b/ci/scripts/tests/test_rocotostat.py @@ -25,17 +25,16 @@ database_destination = os.path.join(testdata_full_path, 'database.db') wget.download(database_url, database_destination) -try: - rocotostat = which('rocotostat') -except CommandNotFoundError: +rocotostat_cmd = which('rocotostat') +if not rocotostat_cmd: raise CommandNotFoundError("rocotostat not found in PATH") -rocotostat.add_default_arg(['-w', os.path.join(testdata_path, 'workflow.xml'), '-d', os.path.join(testdata_path, 'database.db')]) +rocotostat_cmd.add_default_arg(['-w', os.path.join(testdata_path, 'workflow.xml'), '-d', os.path.join(testdata_path, 'database.db')]) def test_rocoto_statcount(): - result = rocoto_statcount(rocotostat) + result = rocoto_statcount(rocotostat_cmd) assert result['SUCCEEDED'] == 20 assert result['FAIL'] == 0 @@ -47,7 +46,7 @@ def test_rocoto_statcount(): def test_rocoto_summary(): - result = rocotostat_summary(rocotostat) + result = rocotostat_summary(rocotostat_cmd) assert result['CYCLES_TOTAL'] == 1 assert result['CYCLES_DONE'] == 1 @@ -55,7 +54,7 @@ def test_rocoto_summary(): def test_rocoto_done(): - result = rocotostat_summary(rocotostat) + result = rocotostat_summary(rocotostat_cmd) assert is_done(result) @@ -79,10 +78,10 @@ def test_rocoto_stalled(): database_destination = os.path.join(testdata_full_path, 'stalled.db') wget.download(database_url, database_destination) - rocotostat = which('rocotostat') - rocotostat.add_default_arg(['-w', xml, '-d', db]) + rocotostat_cmd = which('rocotostat') + rocotostat_cmd.add_default_arg(['-w', xml, '-d', db]) - result = rocoto_statcount(rocotostat) + result = rocoto_statcount(rocotostat_cmd) assert result['SUCCEEDED'] == 11 assert is_stalled(result)