3 from pickle
import dump, loads
4 from functools
import wraps
6 from pkg_resources
import resource_string
10 testfile =
"%s.%s" % (func.__name__, test_data_name)
12 def check_invariant(*args, **kwargs):
13 result = func(*args, **kwargs)
14 if "DQU_UPDATE_TEST_DATA" in environ:
15 with open(test_data_name,
"wb")
as fd:
17 print(
"Wrote updated test data")
19 test_data = loads(resource_string(
"testdata", testfile))
20 assert result == test_data,
"Data considered 'invariant' has changed"
21 return check_invariant