MCPcopy Create free account
hub / github.com/microsoft/debugpy / test_concurrency

Function test_concurrency

tests/tests/test_timeline.py:561–591  ·  view source on GitHub ↗
(make_timeline, daemon, order)

Source from the content-addressed store, hash-verified

559@pytest.mark.timeout(3)
560@pytest.mark.parametrize("order", ["mark_then_wait", "wait_then_mark"])
561def test_concurrency(make_timeline, daemon, order):
562 timeline, initial_history = make_timeline()
563
564 occurrences = []
565 worker_can_proceed = threading.Event()
566
567 @daemon
568 def worker():
569 worker_can_proceed.wait()
570 mark = timeline.mark("tada")
571 occurrences.append(mark)
572
573 if order == "mark_then_wait":
574 worker_can_proceed.set()
575 unblock_worker_later = None
576 else:
577
578 @daemon
579 def unblock_worker_later():
580 time.sleep(0.1)
581 worker_can_proceed.set()
582
583 mark = timeline.wait_for_next(Mark("tada"), freeze=True)
584
585 worker.join()
586 assert mark is occurrences[0]
587 assert timeline.last is mark
588 assert timeline.history() == initial_history + occurrences
589
590 if unblock_worker_later:
591 unblock_worker_later.join()

Callers

nothing calls this directly

Calls 5

MarkFunction · 0.90
make_timelineFunction · 0.85
wait_for_nextMethod · 0.80
historyMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…