-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
29 lines (24 loc) · 814 Bytes
/
test.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
import os
import sys
import argparse
import pacwatch
from io import StringIO
from pathlib import Path
expected_output = Path('tests') / 'data' / 'expected-output'
os.environ['FORCE_COLOR'] = '1'
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--update', action='store_true',
help='update expected output')
parserResult = parser.parse_args()
pacwatch.settings['pacman_command'] = 'python tests/fakePacman.py'
if parserResult.update:
with expected_output.open('w') as f:
sys.stdout = f
pacwatch.main()
else:
output = StringIO()
sys.stdout = output
pacwatch.main()
with expected_output.open('r') as expected:
assert output.getvalue() == expected.read()