Skip to content

Commit

Permalink
tests: Remove a test that's flaky under textual
Browse files Browse the repository at this point in the history
Everything this test exercises is also exercised by the
`test_live_tracking_server_exits_properly_on_sigint` test that still
remains in the `TestLiveRemoteSubcommand` class (same test name,
different test class). That test uses `_wait_until_process_blocks` to
ensure that the SIGINT is sent at a known point in the process's
execution, but this one can't. With this test, the SIGINT is sometimes
delivered while the TUI is still starting up, and at that point, the
signal can result in exceptions (teardown of the TUI tries to access
attributes that weren't created because startup was interrupted).

So, remove this test and rely on the remaining one for coverage of how
SIGINT behaves when interrupting our TUI.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
  • Loading branch information
godlygeek committed Nov 9, 2023
1 parent 525f2e5 commit 7915f10
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions tests/integration/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1546,44 +1546,6 @@ def test_live_tracking(self, tmp_path):
# THEN
assert server.returncode == 0

def test_live_tracking_server_exits_properly_on_sigint(self, tmp_path):
# GIVEN
with track_and_wait(tmp_path) as program_file:
server = subprocess.Popen(
[
sys.executable,
"-m",
"memray",
"run",
"--live",
str(program_file),
],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env={"PYTHONUNBUFFERED": "1"},
# Explicitly reset the signal handler for SIGINT to work around any signal
# masking that might happen on Jenkins.
preexec_fn=lambda: signal.signal(
signal.SIGINT, signal.default_int_handler
),
)

# WHEN

server.send_signal(signal.SIGINT)
try:
_, stderr = server.communicate(timeout=TIMEOUT)
except subprocess.TimeoutExpired:
server.kill()
raise

# THEN
assert server.returncode == 0
assert not stderr
assert b"Exception ignored" not in stderr
assert b"KeyboardInterrupt" not in stderr


class TestTransformSubCommands:
def test_report_detects_missing_input(self):
Expand Down

0 comments on commit 7915f10

Please sign in to comment.