Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Commit 4b6fc5d

Browse files
committed
By setting the REPLACE_EXAMPLES environment variable, you can now overwrite the expected examples with what was actually generated. Useful when an xlwt change means all the example output changes.
1 parent 6ccc00a commit 4b6fc5d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/test_examples.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from cStringIO import StringIO
66
from glob import glob
7-
from os import path
7+
from os import path, environ
88
from os.path import abspath
99
from re import compile
1010
from shutil import copy
@@ -63,9 +63,13 @@ def check_example(package, filename):
6363
actual_data = af.read()
6464

6565
if name in expected_names:
66-
expected_data = open(path.join(expected_base, name), 'rb').read()
66+
expected_path = path.join(expected_base, name)
67+
expected_data = open(expected_path, 'rb').read()
6768
expected_names.remove(name)
6869
if actual_data != expected_data:
70+
if environ.get('REPLACE_EXAMPLES'):
71+
with open(expected_path, 'wb') as new_expected:
72+
new_expected.write(actual_data)
6973
compare(
7074
get_biff_records(expected_data),
7175
get_biff_records(actual_data),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy