Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3yx committed Apr 8, 2022
1 parent 951ec8d commit 74609cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test_miniirc.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,21 @@ def test_get_ca_certs():
def test_start_main_loop(monkeypatch):
irc = DummyIRC()
thread = None
event = threading.Event()

def main(self):
nonlocal thread
assert self is irc
thread = threading.current_thread()
event.set()

monkeypatch.setattr(DummyIRC, '_main', main)

assert irc._main_thread is None
irc._start_main_loop()
assert irc._main_thread is thread
main_thread = irc._main_thread
assert event.wait(1)
assert main_thread is irc._main_thread is thread
assert not hasattr(irc, '_main_lock')

def test_connection(monkeypatch):
Expand Down

0 comments on commit 74609cf

Please sign in to comment.