~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/tutorialservice/test/TestFramework.py

  • Committer: stevenbird
  • Date: 2008-02-19 22:18:13 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:513
test/test_framework/*, exercises/sample/*
* changed root element to exercise (was problem)
* changed test code to call parse_exercise_file (was
    parse_tutorial_file)
* modified samples to show use of new exercise functionality

www/apps/tutorial*:
* consistent naming of methods (nothing talking about "problem" now)

doc/setup/install_proc.txt
* added apt-get for python-ldap, a new dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
497
497
 
498
498
class TestSuite:
499
499
    """
500
 
    The complete collection of test cases for a given problem
 
500
    The complete collection of test cases for a given exercise
501
501
    """
502
502
    def __init__(self, name, solution=None):
503
 
        """Initialise with the name of the test suite (the problem name) and the solution.
 
503
        """Initialise with the name of the test suite (the exercise name) and the solution.
504
504
        The solution may be specified later.
505
505
        """
506
506
        self._solution = solution
509
509
        self.add_include_code("")
510
510
 
511
511
    def add_solution(self, solution):
512
 
        " Specifiy the solution script for this problem "
 
512
        " Specify the solution script for this exercise "
513
513
        self._solution = solution
514
514
 
515
515
    def has_solution(self):
544
544
    def run_tests(self, attempt_code, stop_on_fail=False):
545
545
        " Run all test cases and collate the results "
546
546
        
547
 
        problem_dict = {}
548
 
        problem_dict['name'] = self._name
 
547
        exercise_dict = {}
 
548
        exercise_dict['name'] = self._name
549
549
        
550
550
        test_case_results = []
551
551
        passed = True
554
554
            if 'exception' in result_dict and result_dict['exception']['critical']:
555
555
                # critical error occured, running more cases is useless
556
556
                # FunctionNotFound, Syntax, Indentation
557
 
                problem_dict['critical_error'] = result_dict['exception']
558
 
                problem_dict['passed'] = False
559
 
                return problem_dict
 
557
                exercise_dict['critical_error'] = result_dict['exception']
 
558
                exercise_dict['passed'] = False
 
559
                return exercise_dict
560
560
            
561
561
            test_case_results.append(result_dict)
562
562
            
565
565
                if stop_on_fail:
566
566
                    break
567
567
 
568
 
        problem_dict['cases'] = test_case_results
569
 
        problem_dict['passed'] = passed
570
 
        return problem_dict
 
568
        exercise_dict['cases'] = test_case_results
 
569
        exercise_dict['passed'] = passed
 
570
        return exercise_dict
571
571
 
572
572
    def get_name(self):
573
573
        return self._name