2020
2121# Where can we expect to find Job definitions?
2222_DEFINITION_DIRECTORY : str = 'data-manager'
23- # Data directory
23+ # Where can we expect to find test data?
2424_DATA_DIRECTORY : str = 'data'
2525
2626# The yamllint configuration file of the repository under test.
27- # Expected to be in the repo we're running from .
27+ # It must exist in the root of the repo we're running in .
2828_YAMLLINT_FILE : str = '.yamllint'
2929
3030
@@ -105,9 +105,9 @@ def _load(skip_lint: bool = False) -> Tuple[List[DefaultMunch], int]:
105105 return [], - 1
106106
107107 with open (jd_filename , 'r' ) as jd_file :
108- jd : Dict [str , Any ] = yaml .load (jd_file , Loader = yaml .FullLoader )
109- if jd :
110- jd_munch : DefaultMunch = DefaultMunch .fromDict (jd )
108+ job_def : Dict [str , Any ] = yaml .load (jd_file , Loader = yaml .FullLoader )
109+ if job_def :
110+ jd_munch : DefaultMunch = DefaultMunch .fromDict (job_def )
111111 for jd_name in jd_munch .jobs :
112112 if jd_munch .jobs [jd_name ].tests :
113113 num_tests += len (jd_munch .jobs [jd_name ].tests )
@@ -158,7 +158,7 @@ def _check_exists(name: str, path: str, expected: bool) -> bool:
158158 print ('! FAILURE' )
159159 print (f'! Check exists "{ name } " (does not exist)' )
160160 return False
161- elif not expected and exists :
161+ if not expected and exists :
162162 print (f'# exists ({ expected } ) [FAILED]' )
163163 print ('! FAILURE' )
164164 print (f'! Check does not exist "{ name } " (exists)' )
@@ -329,7 +329,8 @@ def _test(args: argparse.Namespace,
329329 # Run the container
330330 if test_status and not args .dry_run :
331331 # Run the container
332- exit_code , out , err = t_compose .run ()
332+ assert t_compose
333+ exit_code , out , _ = t_compose .run ()
333334
334335 # Delete the test directory?
335336 # Not if there's an error
@@ -353,12 +354,15 @@ def _test(args: argparse.Namespace,
353354 if test_status \
354355 and not args .dry_run \
355356 and job_definition .tests [job_test_name ].checks .outputs :
357+
358+ assert t_compose
356359 test_status = \
357360 _check (t_compose ,
358361 job_definition .tests [job_test_name ].checks .outputs )
359362
360363 # Clean-up
361364 if test_status and not args .keep_results :
365+ assert t_compose
362366 t_compose .delete ()
363367
364368 # Count?
@@ -383,7 +387,7 @@ def _wipe() -> None:
383387# -----------------------------------------------------------------------------
384388# main
385389# -----------------------------------------------------------------------------
386- def main () -> None :
390+ def main () -> int :
387391 """The console script entry-point. Called when jote is executed
388392 or from __main__.py, which is used by the installed console script.
389393 """
@@ -468,7 +472,7 @@ def main() -> None:
468472 if args .wipe :
469473 _wipe ()
470474 print (f'Done [Wiped]' )
471- return
475+ return 0
472476
473477 # Load all the files we can and then run the tests.
474478 job_definitions , num_tests = _load (args .skip_lint )
@@ -503,7 +507,7 @@ def main() -> None:
503507 continue
504508
505509 if job_definition .jobs [job_name ].tests :
506- num_passed , num_ignored , num_failed = \
510+ _ , num_ignored , num_failed = \
507511 _test (args ,
508512 collection ,
509513 job_name ,
@@ -547,6 +551,8 @@ def main() -> None:
547551 if total_fail_count == 0 and not args .keep_results :
548552 _wipe ()
549553
554+ return 0
555+
550556
551557# -----------------------------------------------------------------------------
552558# MAIN
0 commit comments