Skip to content

Commit

Permalink
Check for NoneType after calling which; rename rocotostat to prevent …
Browse files Browse the repository at this point in the history
…nameclash with rocotostat module
  • Loading branch information
DavidHuber-NOAA committed Jul 16, 2024
1 parent 1f2e18a commit 83b4b6f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions ci/scripts/tests/test_rocotostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,15 +46,15 @@ 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


def test_rocoto_done():

result = rocotostat_summary(rocotostat)
result = rocotostat_summary(rocotostat_cmd)

assert is_done(result)

Expand All @@ -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)
Expand Down

0 comments on commit 83b4b6f

Please sign in to comment.