From 9c3aef1f19c5f816586cb50b64a4f0a0625bcbe0 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 6 Jul 2011 14:26:35 -0400 Subject: [PATCH] remove State.masterMode --- test/test.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test.py b/test/test.py index 3f007a21a..59c10bdff 100644 --- a/test/test.py +++ b/test/test.py @@ -71,7 +71,6 @@ class State: remaining = 0 results = { } done = False - masterMode = False numErrors = 0 numEqFailures = 0 numEqNoSnapshot = 0 @@ -158,7 +157,8 @@ class PDFTestHandler(BaseHTTPRequestHandler): # sort the results since they sometimes come in out of order for results in taskResults: results.sort(key=lambda result: result.page) - check(State.manifest[id], taskResults, browser) + check(State.manifest[id], taskResults, browser, + self.server.masterMode) # Please oh please GC this ... del State.taskResults[browser][id] State.remaining -= 1 @@ -285,7 +285,6 @@ def setUp(options): # Only serve files from a pdf.js clone assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git') - State.masterMode = options.masterMode if options.masterMode and os.path.isdir(TMPDIR): print 'Temporary snapshot dir tmp/ is still around.' print 'tmp/ can be removed if it has nothing you need.' @@ -341,7 +340,7 @@ def teardownBrowsers(browsers): print "Temp dir was ", b.tempDir print "Error:", sys.exc_info()[0] -def check(task, results, browser): +def check(task, results, browser, masterMode): failed = False for r in xrange(len(results)): pageResults = results[r] @@ -360,7 +359,7 @@ def check(task, results, browser): kind = task['type'] if 'eq' == kind: - checkEq(task, results, browser) + checkEq(task, results, browser, masterMode) elif 'fbf' == kind: checkFBF(task, results, browser) elif 'load' == kind: @@ -369,7 +368,7 @@ def check(task, results, browser): assert 0 and 'Unknown test type' -def checkEq(task, results, browser): +def checkEq(task, results, browser, masterMode): pfx = os.path.join(REFDIR, sys.platform, browser, task['id']) results = results[0] taskId = task['id'] @@ -407,12 +406,12 @@ def checkEq(task, results, browser): passed = False State.numEqFailures += 1 - if State.masterMode and (ref is None or not eq): + if masterMode and (ref is None or not eq): tmpTaskDir = os.path.join(TMPDIR, sys.platform, browser, task['id']) try: os.makedirs(tmpTaskDir) except OSError, e: - pass + print >>sys.stderr, 'Creating', tmpTaskDir, 'failed!' of = open(os.path.join(tmpTaskDir, str(page + 1)), 'w') of.write(snapshot) @@ -522,6 +521,7 @@ def main(): sys.exit(1) httpd = TestServer((SERVER_HOST, options.port), PDFTestHandler) + httpd.masterMode = options.masterMode httpd_thread = threading.Thread(target=httpd.serve_forever) httpd_thread.setDaemon(True) httpd_thread.start()