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,7 +8,7 @@ import asyncio | ||
| 8 | # user installed packages | 8 | # user installed packages |
| 9 | import bcrypt | 9 | import bcrypt |
| 10 | from sqlalchemy import create_engine | 10 | from sqlalchemy import create_engine |
| 11 | -from sqlalchemy.orm import sessionmaker #, scoped_session | 11 | +from sqlalchemy.orm import sessionmaker |
| 12 | 12 | ||
| 13 | # this project | 13 | # this project |
| 14 | from models import Student, Test, Question | 14 | from models import Student, Test, Question |
| @@ -81,7 +81,7 @@ class App(object): | @@ -81,7 +81,7 @@ class App(object): | ||
| 81 | 81 | ||
| 82 | # command line option --allow-all | 82 | # command line option --allow-all |
| 83 | if conf['allow_all']: | 83 | if conf['allow_all']: |
| 84 | - logger.info('Allowing all students') | 84 | + logger.info('Allowing all students:') |
| 85 | for student in self.get_all_students(): | 85 | for student in self.get_all_students(): |
| 86 | self.allow_student(student[0]) | 86 | self.allow_student(student[0]) |
| 87 | 87 |
demo/test-tutorial.yaml
test.py
| @@ -44,18 +44,23 @@ class TestFactory(dict): | @@ -44,18 +44,23 @@ class TestFactory(dict): | ||
| 44 | self.question_factory.load_files(files=self['files'], questions_dir=self['questions_dir']) | 44 | self.question_factory.load_files(files=self['files'], questions_dir=self['questions_dir']) |
| 45 | 45 | ||
| 46 | # check if all questions exist ('ref' keys are correct?) | 46 | # check if all questions exist ('ref' keys are correct?) |
| 47 | + logger.info('Checking questions for errors:') | ||
| 47 | errors_found = [] | 48 | errors_found = [] |
| 49 | + i = 0 | ||
| 48 | for q in self['questions']: | 50 | for q in self['questions']: |
| 49 | for r in q['ref']: | 51 | for r in q['ref']: |
| 50 | - logger.info(f' Checking "{r}".') | 52 | + i += 1 |
| 51 | try: | 53 | try: |
| 52 | self.question_factory.generate(r) | 54 | self.question_factory.generate(r) |
| 53 | except: | 55 | except: |
| 54 | - logger.critical(f'Cant generate question "{r}".') | 56 | + logger.error(f'Cant generate question "{r}".') |
| 55 | errors_found.append(r) | 57 | errors_found.append(r) |
| 58 | + else: | ||
| 59 | + logger.info(f'{i:4}. "{r}" Ok.') | ||
| 60 | + | ||
| 56 | 61 | ||
| 57 | if errors_found: | 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 | raise TestFactoryException() | 64 | raise TestFactoryException() |
| 60 | else: | 65 | else: |
| 61 | logger.info(f'No errors found. Test factory ready for "{self["ref"]}".') | 66 | logger.info(f'No errors found. Test factory ready for "{self["ref"]}".') |