comparison tests/run-tests.py @ 5800:2f597243e1d7

Make run-tests.py --interactive work on Windows
author Patrick Mezard <pmezard@gmail.com>
date Sat, 05 Jan 2008 17:55:16 +0100
parents 453acf64f71f
children 4dfe7d5b1fc8
comparison
equal deleted inserted replaced
5799:4b82d1a84db8 5800:2f597243e1d7
64 print >> sys.stderr, 'ERROR: -j/--jobs must be positive' 64 print >> sys.stderr, 'ERROR: -j/--jobs must be positive'
65 sys.exit(1) 65 sys.exit(1)
66 if options.interactive and options.jobs > 1: 66 if options.interactive and options.jobs > 1:
67 print >> sys.stderr, 'ERROR: cannot mix -interactive and --jobs > 1' 67 print >> sys.stderr, 'ERROR: cannot mix -interactive and --jobs > 1'
68 sys.exit(1) 68 sys.exit(1)
69
70 def rename(src, dst):
71 """Like os.rename(), trade atomicity and opened files friendliness
72 for existing destination support.
73 """
74 shutil.copy(src, dst)
75 os.remove(src)
69 76
70 def vlog(*msg): 77 def vlog(*msg):
71 if verbose: 78 if verbose:
72 for m in msg: 79 for m in msg:
73 print m, 80 print m,
526 elif not ret: 533 elif not ret:
527 if options.interactive: 534 if options.interactive:
528 print "Accept this change? [n] ", 535 print "Accept this change? [n] ",
529 answer = sys.stdin.readline().strip() 536 answer = sys.stdin.readline().strip()
530 if answer.lower() in "y yes".split(): 537 if answer.lower() in "y yes".split():
531 os.rename(test + ".err", test + ".out") 538 rename(test + ".err", test + ".out")
532 tested += 1 539 tested += 1
533 continue 540 continue
534 failed += 1 541 failed += 1
535 if options.first: 542 if options.first:
536 break 543 break