From 8c006fc347a73c80a48f8ec6a59df633a6e138a6 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Fri, 19 Jul 2013 11:06:37 -0400 Subject: [PATCH] TST: Use xlsx format instead of xls. The xls conversion was corrupting some equations, so switching to use Excel produced xlsx. --- tests/risk/answer_key.py | 34 +++++++++++----------------- tests/risk/risk-answer-key-checksums | 1 + 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/tests/risk/answer_key.py b/tests/risk/answer_key.py index e85ed42e..501e5e4b 100644 --- a/tests/risk/answer_key.py +++ b/tests/risk/answer_key.py @@ -34,12 +34,10 @@ DIR = os.path.dirname(os.path.realpath(__file__)) ANSWER_KEY_CHECKSUMS_PATH = os.path.join(DIR, 'risk-answer-key-checksums') ANSWER_KEY_CHECKSUMS = open(ANSWER_KEY_CHECKSUMS_PATH, 'r').read().splitlines() -ANSWER_KEY_PATH = os.path.join(DIR, 'risk-answer-key.xls') - -ANSWER_KEY_EXISTS = os.path.exists(ANSWER_KEY_PATH) +ANSWER_KEY_PATH = os.path.join(DIR, 'risk-answer-key.xlsx') ANSWER_KEY_DL_TEMPLATE = """ -https://s3.amazonaws.com/zipline-test-data/risk/{md5}+/risk-answer-key.xls +https://s3.amazonaws.com/zipline-test-data/risk/{md5}/risk-answer-key.xlsx """.strip() @@ -49,29 +47,23 @@ def ensure_latest_answer_key(): Logic for determining what and when to download is as such: - - If there is no local xls file, then get the lastest answer key, + - If there is no local spreadsheet file, then get the lastest answer key, as defined by the last row in the checksum file. - - If there is a local xls file: - -- If the xls's checksum is in the checksum file: - --- If the xls's checksum does not match the latest, then grab the + - If there is a local spreadsheet file: + -- If the spreadsheet's checksum is in the checksum file: + --- If the spreadsheet's checksum does not match the latest, then grab the the latest checksum and replace the local checksum file. - --- If the xls's checksum matches the latest, then skip download, and - use the local xls as a cached copy. - -- If the xls's checksum is not in the checksum file, then leave the - local file alone, assuming that the local xls's md5 is not in the list due - to local modifications during development. + --- If the spreadsheet's checksum matches the latest, then skip download, + and use the local spreadsheet as a cached copy. + -- If the spreadsheet's checksum is not in the checksum file, then leave + the local file alone, assuming that the local xls's md5 is not in the list + due to local modifications during development. It is possible that md5's could collide, if that is ever case, we should then find an alternative naming scheme. - The xls answer sheet is not kept in SCM, because its size is on the order - of 20MB, and every edit would increase the repo size. - - xlsx and ods have smaller outputs and could be more friendly to SCM, but: - - not using xlsx, because currently the xlsx that is generated by - LibreOffice is not readable by the xldr module. - - not using ods, because of the lack of a module as facile as xldr for - extracting the data from the ods format. + The spreadsheet answer sheet is not kept in SCM, as every edit would + increase the repo size by the file size, since it is treated as a binary. """ answer_key_dl_checksum = None diff --git a/tests/risk/risk-answer-key-checksums b/tests/risk/risk-answer-key-checksums index f1ec4cc6..9856db9a 100644 --- a/tests/risk/risk-answer-key-checksums +++ b/tests/risk/risk-answer-key-checksums @@ -1 +1,2 @@ 3ac0773c4be4e9e5bacd9c6fa0e03e15 +3a5fae958c8bac684f1773fa8dff7810