pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/commitizen-tools/commitizen/pull/1925.patch

"Test that cmd.run_shell executes a string command via the shell.""" + c = cmd.run_shell("python -c \"print('hello')\"") assert c.return_code == 0 - assert "deprecated" in c.out - assert len(w) == 1 - assert issubclass(w[0].category, DeprecationWarning) - assert "cmd.run()" in str(w[0].message) + assert "hello" in c.out + + +class TestRunInteractive: + def test_zero_return_code_on_success(self): + return_code = cmd.run_interactive(["python", "-c", "import sys; sys.exit(0)"]) + assert return_code == 0 + + def test_nonzero_return_code_on_failure(self): + return_code = cmd.run_interactive(["python", "-c", "import sys; sys.exit(3)"]) + assert return_code == 3 + + def test_env_passed_to_subprocess(self): + return_code = cmd.run_interactive( + [ + "python", + "-c", + "import os, sys; sys.exit(0 if os.environ['CZ_ITEST_VAR'] == 'val' else 1)", + ], + env={"CZ_ITEST_VAR": "val"}, + ) + assert return_code == 0 + + def test_env_merged_with_os_environ(self, monkeypatch): + monkeypatch.setenv("CZ_ITEST_EXISTING", "yes") + return_code = cmd.run_interactive( + [ + "python", + "-c", + "import os, sys; sys.exit(0 if os.environ['CZ_ITEST_EXISTING'] == 'yes' else 1)", + ], + env={"CZ_ITEST_EXTRA": "extra"}, + ) + assert return_code == 0 + + def test_runs_with_string(self): + """Test that passing a string to cmd.run_interactive emits a DeprecationWarning.""" + import warnings + + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + return_code = cmd.run_interactive("python -c \"print('hello')\"") + assert return_code == 0 + assert len(w) == 1 + assert issubclass(w[0].category, DeprecationWarning) + assert "cmd.run_interactive()" in str(w[0].message) + + +class TestRunInteractiveShell: + def test_zero_return_code_on_success(self): + return_code = cmd.run_interactive_shell('python -c "import sys; sys.exit(0)"') + assert return_code == 0 + + def test_nonzero_return_code_on_failure(self): + return_code = cmd.run_interactive_shell('python -c "import sys; sys.exit(3)"') + assert return_code == 3 + + def test_env_passed_to_subprocess(self): + return_code = cmd.run_interactive_shell( + "python -c \"import os, sys; sys.exit(0 if os.environ['CZ_ITEST_VAR'] == 'val' else 1)\"", + env={"CZ_ITEST_VAR": "val"}, + ) + assert return_code == 0 + + def test_env_merged_with_os_environ(self, monkeypatch): + monkeypatch.setenv("CZ_ITEST_EXISTING", "yes") + return_code = cmd.run_interactive_shell( + "python -c \"import os, sys; sys.exit(0 if os.environ['CZ_ITEST_EXISTING'] == 'yes' else 1)\"", + env={"CZ_ITEST_EXTRA": "extra"}, + ) + assert return_code == 0 pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy