-
Notifications
You must be signed in to change notification settings - Fork 4
/
test_simfiles.py
28 lines (22 loc) · 935 Bytes
/
test_simfiles.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
from app import PROJECT_ROOT
from simfile import SMParser
import logging
import os
import unittest
class SimfileTestCase(unittest.TestCase):
def test_no_simfile_errors(self):
errors = []
simfiles_location = PROJECT_ROOT + '/simfiles'
simfiles = os.listdir(simfiles_location)
logging.info('Processing {} simfiles...'.format(len(simfiles)))
for sim in simfiles:
try:
parsed = SMParser(open(simfiles_location + '/' + sim).read())
parsed.analyze(
'Single', list(parsed.charts['Single'].keys())[-1],
preferred_rate=570,
speed_change_threshold=1)
except Exception as e:
errors.append("error in {}: {}: {}".format(sim, e.__class__.__name__, e))
logging.error(errors[-1])
assert len(errors) == 0, "there were one or more simfile errors"