diff --git a/edgetest/utils.py b/edgetest/utils.py index fc2aaf9..03b6149 100644 --- a/edgetest/utils.py +++ b/edgetest/utils.py @@ -40,12 +40,14 @@ def _run_command(*args) -> Tuple[str, int]: Error raised when the command is not successfully executed. """ LOG.debug(f"Running the following command: \n\n {' '.join(args)}") - popen = Popen(args, stdout=PIPE, universal_newlines=True) - out, _ = popen.communicate() + popen = Popen(args, stdout=PIPE, stderr=PIPE, universal_newlines=True) + out, err = popen.communicate() if popen.returncode: raise RuntimeError( - f"Unable to run the following command: \n\n {' '.join(args)}" - ) + f"Unable to run the following command: \n\n {' '.join(args)} \n\n" + f"Returned the following stdout: \n\n {out} \n\n" + f"Returned the following stderr: \n\n {err} \n\n" + ) from None return out, popen.returncode diff --git a/tests/test_core.py b/tests/test_core.py index a19dd6d..18d317f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -72,6 +72,7 @@ def test_basic_setup(mock_popen, mock_path, tmpdir, plugin_manager): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -174,6 +175,7 @@ def test_setup_extras(mock_popen, mock_path, tmpdir, plugin_manager): call( ("uv", "pip", "install", f"--python={py_loc!s}", ".[tests, complete]"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -217,11 +219,13 @@ def test_setup_pip_deps(mock_popen, mock_path, tmpdir, plugin_manager): "otherpkg", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "install", f"--python={py_loc}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -265,6 +269,7 @@ def test_setup_pip_deps_error(mock_popen, mock_path, tmpdir, plugin_manager): "otherpkg", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ] diff --git a/tests/test_interface_cfg.py b/tests/test_interface_cfg.py index bb9bf90..c1e1482 100644 --- a/tests/test_interface_cfg.py +++ b/tests/test_interface_cfg.py @@ -150,16 +150,19 @@ def test_cli_basic(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "install", f"--python={py_loc!s}", "myupgrade", "--upgrade"), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "list", f"--python={py_loc!s}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -211,11 +214,13 @@ def test_cli_basic_lower(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "install", f"--python={py_loc!s}", "mylower==0.0.1"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -274,6 +279,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_myupgrade_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -286,11 +292,13 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "install", f"--python={py_allreq_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -303,6 +311,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -315,6 +324,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "json", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -327,6 +337,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "json", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -425,6 +436,7 @@ def test_cli_nosetup(mock_popen, mock_cpopen): call( ("uv", "pip", "list", f"--python={py_loc}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -506,6 +518,7 @@ def test_cli_notest(mock_popen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -518,11 +531,13 @@ def test_cli_notest(mock_popen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "list", f"--python={py_loc!s}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -558,6 +573,7 @@ def test_cli_notest_lower(mock_popen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -569,6 +585,7 @@ def test_cli_notest_lower(mock_popen, mock_builder): "mylower==0.0.1", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ] diff --git a/tests/test_interface_toml.py b/tests/test_interface_toml.py index acaf0a6..afb26f3 100644 --- a/tests/test_interface_toml.py +++ b/tests/test_interface_toml.py @@ -142,6 +142,7 @@ def test_cli_basic(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -154,11 +155,13 @@ def test_cli_basic(mock_popen, mock_cpopen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "list", f"--python={py_loc!s}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -210,6 +213,7 @@ def test_cli_basic_lower(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -221,6 +225,7 @@ def test_cli_basic_lower(mock_popen, mock_cpopen, mock_builder): "mylower==0.0.1", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -279,6 +284,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): call( ("uv", "pip", "install", f"--python={py_myupgrade_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -291,6 +297,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -302,6 +309,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): ".", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -314,6 +322,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -326,6 +335,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "json", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -338,6 +348,7 @@ def test_cli_reqs(mock_popen, mock_cpopen, mock_builder): "json", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -436,6 +447,7 @@ def test_cli_nosetup(mock_popen, mock_cpopen): call( ("uv", "pip", "list", f"--python={py_loc}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -517,6 +529,7 @@ def test_cli_notest(mock_popen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -529,11 +542,13 @@ def test_cli_notest(mock_popen, mock_builder): "--upgrade", ), stdout=-1, + stderr=-1, universal_newlines=True, ), call( ("uv", "pip", "list", f"--python={py_loc!s}", "--format", "json"), stdout=-1, + stderr=-1, universal_newlines=True, ), ] @@ -569,6 +584,7 @@ def test_cli_notest_lower(mock_popen, mock_builder): call( ("uv", "pip", "install", f"--python={py_loc!s}", "."), stdout=-1, + stderr=-1, universal_newlines=True, ), call( @@ -580,6 +596,7 @@ def test_cli_notest_lower(mock_popen, mock_builder): "mylower==0.0.1", ), stdout=-1, + stderr=-1, universal_newlines=True, ), ]