# Coverage for tests/e2e/test_matching.py : 78%

## 32 statements 25 run 7 missing 0 excluded 0 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1# -*- coding: utf-8 -*-

2 from __future__ import annotations

3

4# -- stdlib --

5# -- third party --

6 import gevent

7

8# -- own --

9 from .mock import Environ, EventTap

10

11

12# -- code --

13 class GameEnded(Exception):

14 pass

15

16

17 def wait():

18 gevent.idle(-100)

19 gevent.sleep(0.01)

20 gevent.idle(-100)

21

22

23 class TestMatching(object):

24 def testMatching(self):

25 env = Environ()

26 t = EventTap()

27

28 s = env.server_core()

29 a = env.client_core()

30 b = env.client_core()

31 t.tap(a, b)

32

33 a.auth.login("Alice")

34 b.auth.login("Bob")

35 wait()

36

37 # Can setup matching

38 a.matching.start(['THBattleKOF'])

39 a.matching.stop()

40 b.matching.start(['THBattleKOF'])

41 wait()

42 assert a.events.game_joined not in t

43 assert s.lobby.state_of(s.lobby.get(a.auth.uid)) == 'lobby'

44 assert s.lobby.state_of(s.lobby.get(b.auth.uid)) == 'lobby'

45 a.matching.start(['THBattleKOF'])

46 wait()

47 assert a.events.game_joined in t

48 assert s.lobby.state_of(s.lobby.get(a.auth.uid)) == 'room'

49 assert s.lobby.state_of(s.lobby.get(b.auth.uid)) == 'room'