Skip to content

Commit 65b494a

Browse files
triggering tests on more selective criteria to avoid churn
1 parent d26c598 commit 65b494a

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
name: e2e docs test
22
on:
3+
issue_comment:
4+
types: [created]
35
workflow_dispatch:
4-
pull_request:
5-
branches:
6-
- main
76
jobs:
87
run-tests:
98
name: run tests
9+
if: |
10+
github.event_name == 'workflow_dispatch' ||
11+
(github.event_name == 'issue_comment' &&
12+
github.event.issue.pull_request &&
13+
github.event.comment.body == 'test this please' &&
14+
github.event.comment.author_association == 'MEMBER')
1015
runs-on: ubuntu-latest
1116
permissions:
1217
contents: "read"

tests/capture_output_stream.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import re
1010
import threading
1111
import time
12-
from queue import Queue, Empty
12+
from queue import Empty, Queue
1313

1414
from jupyter_client.blocking.client import BlockingKernelClient
1515
from watchdog.events import FileSystemEventHandler
@@ -49,13 +49,16 @@ def watch_kernel(connection_file, stop_event):
4949
kc.load_connection_file()
5050
kc.start_channels()
5151

52-
while not stop_event.is_set():
53-
try:
54-
msg = kc.get_iopub_msg(timeout=1)
55-
if msg:
56-
process_msg(msg)
57-
except Exception as _:
58-
continue
52+
try:
53+
while not stop_event.is_set():
54+
try:
55+
msg = kc.get_iopub_msg(timeout=1)
56+
if msg:
57+
process_msg(msg)
58+
except Exception as _:
59+
continue
60+
finally:
61+
kc.stop_channels() # Or some other method to close or clean up the client
5962

6063

6164
def watch_queue(queue, watched_files, stop_event):
@@ -72,9 +75,9 @@ def watch_queue(queue, watched_files, stop_event):
7275
continue
7376

7477

75-
def start_watches():
78+
def start_watches() -> tuple[list[threading.Thread], threading.Event]:
7679
stop_event = threading.Event()
77-
threads = []
80+
threads: list[threading.Thread] = []
7881
paths_to_watch = [
7982
f"{os.path.expanduser('~')}/Library/Jupyter/runtime/",
8083
"/private/var/folders/9n/1rd9yjf913s10bzn5w9mdf_m0000gn/T/",

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ def gcp_setup(auth_tb_quickstart):
133133
finally:
134134
stop_event.set()
135135
for thread in threads:
136-
thread.join() # Wait for threads to finish
136+
thread.join(timeout=1)
137+
if thread.is_alive():
138+
logger.warning(f"Thread {thread.name} did not stop as expected")
137139

138140

139141
def delete_state_lock(

tests/loading_datasets_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33

44
import pytest
5-
from conftest import auth_tb_loading_datasets, auth_tb_quickstart, tb_quickstart
5+
from conftest import auth_tb_loading_datasets
66
from pytest_dependency import depends
77

88

0 commit comments

Comments
 (0)