diff --git a/serve.py b/serve.py index 7fb278e..63bab67 100755 --- a/serve.py +++ b/serve.py @@ -323,6 +323,7 @@ def main(): argparser.add_argument('--allow-all', action='store_true', help='Students are initially allowed to login (can be denied later)') argparser.add_argument('--debug', action='store_true', help='Enable debug messages') argparser.add_argument('--show-ref', action='store_true', help='Show question references') + argparser.add_argument('--review', action='store_true', help='Review mode: don\'t generate test') arg = argparser.parse_args() @@ -344,6 +345,7 @@ def main(): 'debug': arg.debug, 'allow_all': arg.allow_all, 'show_ref': arg.show_ref, + 'review': arg.review, } try: diff --git a/test.py b/test.py index dbdbb21..df1ef64 100644 --- a/test.py +++ b/test.py @@ -34,21 +34,24 @@ class TestFactory(dict): # set defaults and sanity checks self.sanity_checks() - # loads question_factory - self.question_factory = questions.QuestionFactory() - self.question_factory.load_files(files=self['files'], questions_dir=self['questions_dir']) - - # check if all questions exist ('ref' keys are correct?) - for q in self['questions']: - for r in q['ref']: - logger.info(f'Checking question "{r}".') - try: - self.question_factory.generate(r) - except questions.QuestionFactoryException: - logger.critical(f'Can\'t generate question "{r}".') - raise TestFactoryException() - - logger.info(f'Test factory ready for "{self["ref"]}".') + if conf['review']: + logger.info('Review mode. No questions loaded.') + else: + # loads question_factory + self.question_factory = questions.QuestionFactory() + self.question_factory.load_files(files=self['files'], questions_dir=self['questions_dir']) + + # check if all questions exist ('ref' keys are correct?) + for q in self['questions']: + for r in q['ref']: + logger.info(f'Checking question "{r}".') + try: + self.question_factory.generate(r) + except questions.QuestionFactoryException: + logger.critical(f'Can\'t generate question "{r}".') + raise TestFactoryException() + + logger.info(f'Test factory ready for "{self["ref"]}".') # ----------------------------------------------------------------------- -- libgit2 0.21.2