changeset 43:81f58c938ec5

Fixed the -s option
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 05 Dec 2010 15:37:35 +0100
parents 44609b41868b
children e92e6d4aa2ef
files 2.00/config.py 2.00/testcases.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/2.00/config.py	Sun Dec 05 15:29:17 2010 +0100
+++ b/2.00/config.py	Sun Dec 05 15:37:35 2010 +0100
@@ -42,6 +42,9 @@
                     'ansname': ''}
 defaults_global = {'tasknames': None,
                    'force_zero_exitcode': True}
+defaults_noerase = {'inname': '%.in',
+                    'outname': '%.out',
+                    'ansname': '%.ans'}
 patterns = ('inname', 'outname', 'ansname', 'testcaseinname',
             'testcaseoutname', 'dummyinname', 'dummyoutname')
 
@@ -170,6 +173,9 @@
 			del sys.modules['testconf']
 	for name in defaults_global:
 		setattr(module, name, getattr(module, name, defaults_global[name]))
+	if not options.erase:
+		for name in defaults_noerase:
+			setattr(module, name, getattr(module, name, defaults_noerase[name]))
 	global globalconf
 	globalconf = module
 	sys.dont_write_bytecode = dwb
--- a/2.00/testcases.py	Sun Dec 05 15:29:17 2010 +0100
+++ b/2.00/testcases.py	Sun Dec 05 15:37:35 2010 +0100
@@ -1,6 +1,8 @@
 #! /usr/bin/env python
 # Copyright (c) 2010 Chortos-2 <chortos@inbox.lv>
 
+# TODO: copy the ansfile if not options.erase even if no validator is used
+
 from __future__ import division, with_statement
 
 try:
@@ -353,7 +355,7 @@
 		case.open_infile()
 		case.time_started = None
 		if case.problem.config.stdio:
-			if options.erase and not case.validator:
+			if options.erase and not case.validator and case.problem.config.inname:
 				# TODO: re-use the same file name if possible
 				# FIXME: 2.5 lacks the delete parameter
 				with tempfile.NamedTemporaryFile(delete=False) as f: