def parameters_are_passed_to_test_command_as_environment_variables(operations): source_files = [ plain_file("whack/whack.json", json.dumps({"test": '[ "$VERSION" = "1" ]'})), plain_file("zero", "0"), ] with create_temporary_dir(source_files) as package_source_dir: test_result = operations.test(package_source_dir, params={"version": "1"}) assert_equal(True, test_result.passed)
def test_command_is_run_in_root_of_source_dir(operations): source_files = [ plain_file( "whack/whack.json", json.dumps({"test": "exit `cat zero || echo 1`", "sourcePaths": ["whack", "zero"]}) ), plain_file("zero", "0"), ] with create_temporary_dir(source_files) as package_source_dir: test_result = operations.test(package_source_dir) assert_equal(True, test_result.passed)
def whack_test_passes_if_test_command_has_zero_return_code(operations): source_files = [plain_file("whack/whack.json", json.dumps({"test": "true"}))] with create_temporary_dir(source_files) as package_source_dir: test_result = operations.test(package_source_dir) assert_equal(True, test_result.passed)
def whack_test_fails_if_test_is_not_set_in_whack_json(operations): source_files = [plain_file("whack/whack.json", json.dumps({}))] with create_temporary_dir(source_files) as package_source_dir: test_result = operations.test(package_source_dir) assert_equal(False, test_result.passed)