Merge pull request #2265 from yurydelendik/fix-test-pdfs
Fixes test pdfs MD5; make server does not download
This commit is contained in:
commit
66b9cc8a47
2
make.js
2
make.js
@ -751,7 +751,7 @@ target.server = function() {
|
|||||||
echo('### Starting local server');
|
echo('### Starting local server');
|
||||||
|
|
||||||
cd('test');
|
cd('test');
|
||||||
exec(PYTHON_BIN + ' -u test.py --port=8888', {async: true});
|
exec(PYTHON_BIN + ' -u test.py --port=8888 --noDownload', {async: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1 +1 @@
|
|||||||
http://web.archive.org/web/20110623114753/http://www.cdc.gov/ncidod/dvbid/westnile/languages/chinese.pdf
|
http://www.cdc.gov/ncidod/dvbid/westnile/languages/chinese.pdf
|
||||||
|
25
test/test.py
25
test/test.py
@ -55,6 +55,10 @@ class TestOptions(OptionParser):
|
|||||||
help="The port the HTTP server should listen on.", default=8080)
|
help="The port the HTTP server should listen on.", default=8080)
|
||||||
self.add_option("--unitTest", action="store_true", dest="unitTest",
|
self.add_option("--unitTest", action="store_true", dest="unitTest",
|
||||||
help="Run the unit tests.", default=False)
|
help="Run the unit tests.", default=False)
|
||||||
|
self.add_option("--noDownload", action="store_true", dest="noDownload",
|
||||||
|
help="Skips test PDFs downloading.", default=False)
|
||||||
|
self.add_option("--ignoreDownloadErrors", action="store_true", dest="ignoreDownloadErrors",
|
||||||
|
help="Ignores errors during test PDFs downloading.", default=False)
|
||||||
self.set_usage(USAGE_EXAMPLE)
|
self.set_usage(USAGE_EXAMPLE)
|
||||||
|
|
||||||
def verifyOptions(self, options):
|
def verifyOptions(self, options):
|
||||||
@ -380,10 +384,7 @@ def makeBrowserCommands(browserManifestFile):
|
|||||||
browsers = [makeBrowserCommand(browser) for browser in json.load(bmf)]
|
browsers = [makeBrowserCommand(browser) for browser in json.load(bmf)]
|
||||||
return browsers
|
return browsers
|
||||||
|
|
||||||
def downloadLinkedPDFs(manifestList):
|
def downloadLinkedPDF(f):
|
||||||
for item in manifestList:
|
|
||||||
f, isLink = item['file'], item.get('link', False)
|
|
||||||
if isLink and not os.access(f, os.R_OK):
|
|
||||||
linkFile = open(f +'.link')
|
linkFile = open(f +'.link')
|
||||||
link = linkFile.read()
|
link = linkFile.read()
|
||||||
linkFile.close()
|
linkFile.close()
|
||||||
@ -397,6 +398,19 @@ def downloadLinkedPDFs(manifestList):
|
|||||||
|
|
||||||
print 'done'
|
print 'done'
|
||||||
|
|
||||||
|
def downloadLinkedPDFs(manifestList, ignoreDownloadErrors):
|
||||||
|
for item in manifestList:
|
||||||
|
f, isLink = item['file'], item.get('link', False)
|
||||||
|
if isLink and not os.access(f, os.R_OK):
|
||||||
|
try:
|
||||||
|
downloadLinkedPDF(f)
|
||||||
|
except:
|
||||||
|
print 'ERROR: Unable to download file "' + f + '".'
|
||||||
|
if ignoreDownloadErrors:
|
||||||
|
open(f, 'wb').close()
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|
||||||
def verifyPDFs(manifestList):
|
def verifyPDFs(manifestList):
|
||||||
error = False
|
error = False
|
||||||
for item in manifestList:
|
for item in manifestList:
|
||||||
@ -447,7 +461,8 @@ def setUp(options):
|
|||||||
with open(options.manifestFile) as mf:
|
with open(options.manifestFile) as mf:
|
||||||
manifestList = json.load(mf)
|
manifestList = json.load(mf)
|
||||||
|
|
||||||
downloadLinkedPDFs(manifestList)
|
if not options.noDownload:
|
||||||
|
downloadLinkedPDFs(manifestList, options.ignoreDownloadErrors)
|
||||||
|
|
||||||
if not verifyPDFs(manifestList):
|
if not verifyPDFs(manifestList):
|
||||||
print 'Unable to verify the checksum for the files that are used for testing.'
|
print 'Unable to verify the checksum for the files that are used for testing.'
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
{ "id": "intelisa-eq",
|
{ "id": "intelisa-eq",
|
||||||
"file": "pdfs/intelisa.pdf",
|
"file": "pdfs/intelisa.pdf",
|
||||||
"md5": "c1444b7ccd935c0577d094297e1a6448",
|
"md5": "cdbcf14d0d260c0b313c566a61b07d9f",
|
||||||
"link": true,
|
"link": true,
|
||||||
"pageLimit": 100,
|
"pageLimit": 100,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
{ "id": "shavian-load",
|
{ "id": "shavian-load",
|
||||||
"file": "pdfs/shavian.pdf",
|
"file": "pdfs/shavian.pdf",
|
||||||
"md5": "79253352f48b55b7fa28a2586875d8b7",
|
"md5": "40ef97a120250b149c4ded383ca328ec",
|
||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
@ -199,7 +199,7 @@
|
|||||||
},
|
},
|
||||||
{ "id": "fips197",
|
{ "id": "fips197",
|
||||||
"file": "pdfs/fips197.pdf",
|
"file": "pdfs/fips197.pdf",
|
||||||
"md5": "374800cf78ce4b4abd02cd10a856b57f",
|
"md5": "4742c3f470cd8c4686a0dbb3da808b71",
|
||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
Loading…
Reference in New Issue
Block a user