def wrapper(*args, **kwargs): plt.figure() name = "{0}.{1}".format(test_function.__module__, test_function.__name__) figure_hash = hash.hash_figure(test_function(*args, **kwargs)) if name not in hash.hash_library: hash.hash_library[name] = figure_hash pytest.fail("Hash not present: {0}".format(name)) else: assert hash.hash_library[name] == figure_hash
def wrapper(*args, **kwargs): plt.figure() name = "{0}.{1}".format(test_function.__module__, test_function.__name__) pngfile = tempfile.NamedTemporaryFile(delete=False) figure_hash = hash.hash_figure(test_function(*args, **kwargs), out_stream=pngfile) figure_test_pngfiles[name] = pngfile.name pngfile.close() new_hash_library[name] = figure_hash if name not in hash.hash_library: pytest.fail("Hash not present: {0}".format(name)) else: assert hash.hash_library[name] == figure_hash plt.close()
def wrapper(*args, **kwargs): plt.figure() name = "{0}.{1}".format(test_function.__module__, test_function.__name__) pngfile = tempfile.NamedTemporaryFile(delete=False) figure_hash = hash.hash_figure(test_function(*args, **kwargs), out_stream=pngfile) figure_test_pngfiles[name] = pngfile.name pngfile.close() new_hash_library[name] = figure_hash if name not in hash.hash_library: pytest.fail("Hash not present: {0}".format(name)) else: assert hash.hash_library[name] == figure_hash
def wrapper(*args, **kwargs): if not os.path.exists(hash.HASH_LIBRARY_FILE): pytest.xfail('Could not find a figure hash library at {}'.format( hash.HASH_LIBRARY_FILE)) plt.figure() name = "{0}.{1}".format(test_function.__module__, test_function.__name__) pngfile = tempfile.NamedTemporaryFile(delete=False) figure_hash = hash.hash_figure(test_function(*args, **kwargs), out_stream=pngfile) figure_test_pngfiles[name] = pngfile.name pngfile.close() new_hash_library[name] = figure_hash if name not in hash.hash_library: pytest.fail("Hash not present: {0}".format(name)) else: assert hash.hash_library[name] == figure_hash plt.close()