Skip to content

Commit

Permalink
Do not send keyboard interrupts in Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cjolowicz committed Mar 3, 2021
1 parent 833d44f commit 72f7cd2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ def marker(tmp_path):

def interrupt_process(proc):
"""Send SIGINT or CTRL_C_EVENT to the process."""
if platform.system() == "Windows" and "CI" in os.environ:
# Do nothing. The interrupt would be received by every console process,
# including the parent process of pytest that is running the CI step.
return

if platform.system() == "Windows":
# https://stackoverflow.com/a/35792192
import threading
Expand Down Expand Up @@ -302,6 +307,10 @@ def test_interrupt_raises(command_with_keyboard_interrupt, program, marker):
nox.command.run([PYTHON, "-c", format_program(program, marker)])


@pytest.mark.skipif(
platform.system() == "Windows" and "CI" in os.environ,
reason="On Windows CI, the keyboard interrupt would terminate our parent process.",
)
def test_interrupt_handled(command_with_keyboard_interrupt, marker):
"""It does not raise if the child handles the keyboard interrupt."""
program = """
Expand Down

0 comments on commit 72f7cd2

Please sign in to comment.