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

« back to all changes in this revision

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

  • Committer: dilshan_a
  • Date: 2008-01-25 04:35:06 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:309
Added a passed key to return value of problem suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
        problem_dict['name'] = self._name
529
529
        
530
530
        test_case_results = []
 
531
        passed = True
531
532
        for test in self._tests:
532
533
            result_dict = test.run(self._solution, attempt_code)
533
534
            if 'exception' in result_dict and result_dict['exception']['critical']:
534
535
                # critical error occured, running more cases is useless
535
536
                # FunctionNotFound, Syntax, Indentation
536
537
                problem_dict['critical_error'] = result_dict['exception']
 
538
                problem_dict['passed'] = False
537
539
                return problem_dict
538
540
            
539
541
            test_case_results.append(result_dict)
540
542
            
541
 
            if not result_dict['passed'] and stop_on_fail:
542
 
                break
 
543
            if not result_dict['passed']:
 
544
                passed = False
 
545
                if stop_on_fail:
 
546
                    break
543
547
 
544
548
        problem_dict['cases'] = test_case_results
 
549
        problem_dict['passed'] = passed
545
550
        return problem_dict
546
551
 
547
552
    def get_name(self):
574
579
        """ Open a file from the filespace with the given mode.
575
580
        Return a StringIO subclass object with the file contents.
576
581
        """
 
582
        # currently very messy, needs to be cleaned up
 
583
        # Probably most of this should be in the initialiser to the TestStringIO
 
584
        
577
585
        import re
578
586
 
579
587
        if filename in self._open_files: