diff --git a/porcupine/plugins/run/windows_run.py b/porcupine/plugins/run/windows_run.py index 0767df638..7f892c089 100644 --- a/porcupine/plugins/run/windows_run.py +++ b/porcupine/plugins/run/windows_run.py @@ -9,26 +9,27 @@ import colorama -colorama.init() +if __name__ == "__main__": + colorama.init() -prog, directory, command = sys.argv -print(colorama.Fore.BLUE + command + colorama.Fore.RESET) -try: - returncode: int | None = subprocess.call(command, cwd=directory, shell=True) -except KeyboardInterrupt: - # the subprocess should have already printed any traceback or - # whatever it might want to print - # TODO: try to catch the return code in this case as well? - returncode = None + prog, directory, command = sys.argv + print(colorama.Fore.BLUE + command + colorama.Fore.RESET) + try: + returncode: int | None = subprocess.call(command, cwd=directory, shell=True) + except KeyboardInterrupt: + # the subprocess should have already printed any traceback or + # whatever it might want to print + # TODO: try to catch the return code in this case as well? + returncode = None -print() -print("-----------------------------") -if returncode == 0: - print("The program completed successfully.") -elif returncode is None: - print("The program was interrupted.") -else: - print(f"The program failed with status {returncode}.") + print() + print("-----------------------------") + if returncode == 0: + print("The program completed successfully.") + elif returncode is None: + print("The program was interrupted.") + else: + print(f"The program failed with status {returncode}.") -print("Press Enter to close this window...") -input() + print("Press Enter to close this window...") + input() diff --git a/pytest.ini b/pytest.ini index 481e16da1..3263f74ca 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,7 +1,10 @@ [pytest] # why we disable nose plugin: https://github.com/pytest-dev/pytest/issues/10825 -addopts = --doctest-modules --capture=no -p no:nose -testpaths = porcupine/plugins/autoindent.py tests/ +# +# The debug prompt plugin's docstring contains a ">>>" that isn't a doctest. +# I don't want a "# doctest: +SKIP" comment because it would show up in the plugin manager. +addopts = --doctest-modules --capture=no -p no:nose --ignore porcupine/plugins/porcupine_debug_prompt.py +testpaths = porcupine/ tests/ markers = pastebin_test # uncomment this if you dare... i like how pytest hides the shittyness