comparison problem.py @ 83:37c4ad87583c

Several small fixes Bug fix: testconf.py bytecode is written on Python 2.5. It is not written on newer versions of Python, but Python 2.5 lacks the facility to disable writing it; before this fix, the code just raised an unhandled exception. Bug fix: callable validators no longer require the outfile configuration variable to be set. Bug fix: the pause configuration variable (if not callable) is run in a shell just like it did in test.py v1; in particular, auto-detected values of the pause configuration variable now work again. Extras: *.{class,orig} added to .hgignore; Sublime Text 1 project file removed as I am using Sublime Text 2 now.
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 24 Feb 2011 00:10:19 +0000
parents 06356af50bf9
children 741ae3391b61
comparison
equal deleted inserted replaced
82:06356af50bf9 83:37c4ad87583c
205 valued = ' (%d/%d valued)' % (contexts[0].ncorrectvalued, contexts[0].nvalued) 205 valued = ' (%d/%d valued)' % (contexts[0].ncorrectvalued, contexts[0].nvalued)
206 say('Problem total: %d/%d tests%s, %g/%g points%s' % (contexts[0].ncorrect, contexts[0].ntotal, valued, weighted, prob.config.taskweight, before_weighting)) 206 say('Problem total: %d/%d tests%s, %g/%g points%s' % (contexts[0].ncorrect, contexts[0].ntotal, valued, weighted, prob.config.taskweight, before_weighting))
207 sys.stdout.flush() 207 sys.stdout.flush()
208 return weighted, prob.config.taskweight 208 return weighted, prob.config.taskweight
209 finally: 209 finally:
210 if options.erase and (not prob.config.stdio or case and case.validator): 210 if options.erase and (not prob.config.stdio or case and
211 (case.validator and not callable(case.validator))):
211 for var in 'in', 'out': 212 for var in 'in', 'out':
212 name = getattr(prob.config, var + 'name') 213 name = getattr(prob.config, var + 'name')
213 if name: 214 if name:
214 try: 215 try:
215 os.remove(name) 216 os.remove(name)