Skip to content

Commit

Permalink
Remove hack from pytest.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Jul 1, 2023
1 parent c080f68 commit 20006f3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
41 changes: 21 additions & 20 deletions porcupine/plugins/run/windows_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 5 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 20006f3

Please sign in to comment.