diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5bc918c..2494a90 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,10 @@ Changelog ********* +0.3.1 (6/06/2023) +================ +* `run_component`: fix a bug where `pytest.fail` was used when running a component failed instead of using `CalledProcessError`. + 0.3.0 (6/06/2023) ================= * `run_component`: when the component fails, stack traces from helper functions are no longer shown. diff --git a/viashpy/testing.py b/viashpy/testing.py index a1b3ef3..9833852 100644 --- a/viashpy/testing.py +++ b/viashpy/testing.py @@ -101,6 +101,7 @@ def run_component(caplog, executable, viash_source_config_path, viash_executable def run_and_handle_errors(function_to_run): @wraps(function_to_run) def wrapper(*args, **kwargs): + __tracebackhide__ = True try: return function_to_run(*args, **kwargs) except CalledProcessError as e: @@ -109,10 +110,10 @@ def wrapper(*args, **kwargs): logger.info( f"Captured component output was:\n{e.stdout.decode('utf-8')}" ) - pytest.fail( - f"The component exited with exitcode {e.returncode}.", - pytrace=False, - ) + # Create a new CalledProcessError object. This removes verbosity from the original object + raise CalledProcessError( + e.returncode, e.cmd, output=None, stderr=None + ) from None return wrapper