def test_run_tests_from_s3(): db = _get_test_db() (mm, sg) = run_model_tests_from_s3('test', upload_mm=False, upload_results=False, upload_stats=False, registered_queries=False, db=db) assert isinstance(mm, ModelManager) assert isinstance(mm.model, EmmaaModel) assert isinstance(mm.mc_types['pysb']['model_checker'], PysbModelChecker) assert isinstance(mm.mc_types['pysb']['test_results'][0], PathResult) assert isinstance(mm.applicable_tests[0], StatementCheckingTest) assert len(mm.applicable_tests) == 1 assert len(mm.mc_types['pysb']['test_results']) == 1 assert isinstance(sg, StatsGenerator) assert isinstance(sg.latest_round, TestRound) assert isinstance(sg.latest_round.mc_types_results['pysb'][0], PathResult) assert isinstance(sg.latest_round.statements[0], Statement) assert len(sg.latest_round.statements) == 2 assert len(sg.latest_round.mc_types_results['pysb']) == 1 assert len(sg.latest_round.tests) == 1
def test_run_model_tests_from_s3(): # Local imports are recommended when using moto from emmaa.model_tests import run_model_tests_from_s3, ModelManager from emmaa.model import last_updated_date client = setup_bucket(add_tests=True, add_mm=True) # There should not be any results assert not last_updated_date('test', 'test_results', tests='simple_tests', extension='.json', bucket=TEST_BUCKET_NAME) mm = run_model_tests_from_s3('test', 'simple_tests', upload_results=True, bucket=TEST_BUCKET_NAME) assert isinstance(mm, ModelManager) # Results are saved now assert last_updated_date('test', 'test_results', tests='simple_tests', extension='.json', bucket=TEST_BUCKET_NAME)
import argparse from emmaa.model_tests import run_model_tests_from_s3 if __name__ == '__main__': parser = argparse.ArgumentParser( description='Script to run tests against models, both stored on ' 'Amazon S3.') parser.add_argument('-m', '--model', help='Model name', required=True) args = parser.parse_args() run_model_tests_from_s3(args.model, upload_results=True, upload_stats=True)
import argparse from emmaa.model_tests import run_model_tests_from_s3 if __name__ == '__main__': parser = argparse.ArgumentParser( description='Script to run tests against models, both stored on ' 'Amazon S3.') parser.add_argument('-m', '--model', help='Model name', required=True) parser.add_argument('-t', '--tests', default='large_corpus_tests', help='Test file name (optional). Default is ' 'large_corpus_tests') args = parser.parse_args() run_model_tests_from_s3(args.model, test_corpus=args.tests, upload_results=True)