aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2017-09-15 16:50:30 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2017-09-15 16:51:38 +0200
commit3018160e71cf2c2623b0f4d887ce4780c888ab35 (patch)
treeadc390403e37fc113fa4428112528c6d773217a2
parent53749592c8443f13879ea9264a22eea150ca9f47 (diff)
downloadwee-slack-3018160e71cf2c2623b0f4d887ce4780c888ab35.tar.gz
test: Empty eventrouter queue when initializing it
The commit 6718e2f added some more events to the queue when a buffer is created. This made some tests fail as it would process these events instead of the ones added in the tests. Fix it by processing all events in the queue when setting up the eventrouter for the tests.
-rw-r--r--_pytest/conftest.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/_pytest/conftest.py b/_pytest/conftest.py
index 4f94983..232814f 100644
--- a/_pytest/conftest.py
+++ b/_pytest/conftest.py
@@ -31,7 +31,8 @@ def realish_eventrouter(mock_weechat):
context = e.store_context(SlackRequest('xoxoxoxox', "rtm.start", {"meh": "blah"}))
rtmstartdata = open('_pytest/data/http/rtm.start.json', 'r').read()
e.receive_httprequest_callback(context, 1, 0, rtmstartdata, 4)
- e.handle_next()
+ while len(e.queue):
+ e.handle_next()
#e.sc is just shortcuts to these items
e.sc = {}
e.sc["team_id"] = e.teams.keys()[0]