def test_run_tests(cookies): """generated project should run tests""" with bake_in_temp_dir(cookies, extra_context={}) as result: res = result.project.join('') try: sh.pytest(res) except sh.ErrorReturnCode as e: pytest.fail(str(e))
def has_tests(svc): try: sh.pytest('--collect-only', f'{CFG.APP_TESTPATH}/{svc}', _env={'PYTHONPATH': f'{CFG.APP_PROJPATH}/{svc}'}) return True except (sh.ErrorReturnCode_4, sh.ErrorReturnCode_5): return False
def test_generated_package(cookies): """Generated project should pass test execution.""" result = cookies.bake() base_path = str(result.project) try: sh.pytest('{0}/tests'.format(base_path)) except sh.ErrorReturnCode as e: pytest.fail(e)
def run_datasets_tests(datasets_path, dataset_name, dummy = False): test_name = "dataset_all_configs" if dummy else "real_dataset" with cd(datasets_path.parent): sh.pytest(f"tests/test_dataset_common.py::LocalDatasetTest::test_load_{test_name}_{dataset_name}", _fg = _fg, _env={"RUN_SLOW":"1"})