-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.py
50 lines (32 loc) · 860 Bytes
/
test_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
import sys
import pytest
class FakeGameUI(object):
counter = 3
def load_settings(self):
pass
def init(self):
pass
def wait_for_tick(self):
pass
def interact(self):
self.counter -= 1
if self.counter <= 0:
sys.exit()
def draw(self):
pass
def save_settings(self):
pass
def doctest_main():
"""Test for main
>>> from pyspacewar.main import main
>>> main(['-f', '-d', '--no-sound', '--no-music', '-m', '640x480'])
>>> main(['-m', 'lalala'])
Traceback (most recent call last):
...
SystemExit: pyspacewar: error: invalid mode: lalala
"""
@pytest.fixture(scope='module', autouse=True)
def fake_game_ui(test=None):
from pyspacewar import main
main.GameUI = FakeGameUI