Commit d0f5a59794517443fadf29eecd0434d980d753b9
1 parent
61aa3d29
Exists in
master
and in
1 other branch
- minor changes in logging text
Showing
3 changed files
with
11 additions
and
6 deletions
Show diff stats
app.py
... | ... | @@ -8,7 +8,7 @@ import asyncio |
8 | 8 | # user installed packages |
9 | 9 | import bcrypt |
10 | 10 | from sqlalchemy import create_engine |
11 | -from sqlalchemy.orm import sessionmaker #, scoped_session | |
11 | +from sqlalchemy.orm import sessionmaker | |
12 | 12 | |
13 | 13 | # this project |
14 | 14 | from models import Student, Test, Question |
... | ... | @@ -81,7 +81,7 @@ class App(object): |
81 | 81 | |
82 | 82 | # command line option --allow-all |
83 | 83 | if conf['allow_all']: |
84 | - logger.info('Allowing all students') | |
84 | + logger.info('Allowing all students:') | |
85 | 85 | for student in self.get_all_students(): |
86 | 86 | self.allow_student(student[0]) |
87 | 87 | ... | ... |
demo/test-tutorial.yaml
test.py
... | ... | @@ -44,18 +44,23 @@ class TestFactory(dict): |
44 | 44 | self.question_factory.load_files(files=self['files'], questions_dir=self['questions_dir']) |
45 | 45 | |
46 | 46 | # check if all questions exist ('ref' keys are correct?) |
47 | + logger.info('Checking questions for errors:') | |
47 | 48 | errors_found = [] |
49 | + i = 0 | |
48 | 50 | for q in self['questions']: |
49 | 51 | for r in q['ref']: |
50 | - logger.info(f' Checking "{r}".') | |
52 | + i += 1 | |
51 | 53 | try: |
52 | 54 | self.question_factory.generate(r) |
53 | 55 | except: |
54 | - logger.critical(f'Cant generate question "{r}".') | |
56 | + logger.error(f'Cant generate question "{r}".') | |
55 | 57 | errors_found.append(r) |
58 | + else: | |
59 | + logger.info(f'{i:4}. "{r}" Ok.') | |
60 | + | |
56 | 61 | |
57 | 62 | if errors_found: |
58 | - logger.critical(f'{errors_found} errors found generating questions.') | |
63 | + logger.critical(f'Found {len(errors_found)} error(s) while generating questions.') | |
59 | 64 | raise TestFactoryException() |
60 | 65 | else: |
61 | 66 | logger.info(f'No errors found. Test factory ready for "{self["ref"]}".') | ... | ... |