Skip to content

Commit c4f1061

Browse files
committed
[DEBUG] Add debug output to check stuff happening in workflow
1 parent 9615ea8 commit c4f1061

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

medcat-v2/tests/components/addons/meta_cat/test_bert_meta_cat.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import socket
22
from contextlib import contextmanager
33
import time
4+
import threading
5+
import traceback
46

57
from medcat.components.addons.meta_cat import meta_cat
68
from medcat.storage.serialisers import serialise, deserialise
@@ -81,11 +83,33 @@ def tearDownClass(cls):
8183
cls.temp_dir.cleanup()
8284

8385
def test_no_network_load(self):
86+
import threading
87+
import sys
88+
import os
89+
90+
print("=== DEBUG: Environment ===")
91+
print(f"CI: {os.getenv('CI')}")
92+
print(f"GITHUB_ACTIONS: {os.getenv('GITHUB_ACTIONS')}")
93+
print(f"Python version: {sys.version}")
94+
print(f"Transformers version: {transformers.__version__}")
95+
print(f"Initial thread count: {threading.active_count()}")
96+
print(f"Initial threads: {[t.name for t in threading.enumerate()]}")
97+
8498
with assert_tries_network():
8599
with force_hf_download():
100+
print("=== DEBUG: Before deserialise ===")
101+
print(f"Thread count: {threading.active_count()}")
86102
mc = deserialise(self.mc_save_path)
87103
# NOTE: the network calls are done async
88104
# and as such we may need to wait for them
89105
# to be done before we exit the context managers,
90-
time.sleep(1.0)
106+
print(f"=== DEBUG: After deserialise ===")
107+
print(f"Thread count: {threading.active_count()}")
108+
print(f"Current threads: {[t.name for t in threading.enumerate()]}")
109+
wait_time = 5.0 if os.getenv('CI') else 1.0
110+
print(f"=== DEBUG: Waiting {wait_time}s for background threads ===")
111+
time.sleep(wait_time)
112+
print("=== DEBUG: After wait ===")
113+
print(f"Thread count: {threading.active_count()}")
114+
91115
self.assertIsInstance(mc, meta_cat.MetaCATAddon)

0 commit comments

Comments
 (0)