MCPcopy Create free account
hub / github.com/gitless-vcs/gitless / __assert_decorator

Function __assert_decorator

gitless/tests/test_core.py:102–120  ·  view source on GitHub ↗
(msg, prop, *fps)

Source from the content-addressed store, hash-verified

100
101
102def __assert_decorator(msg, prop, *fps):
103 def decorator(f):
104 @wraps(f)
105 def wrapper(*args, **kwargs):
106 self = args[0]
107 # We save up the cwd to chdir to it after the test has run so that the
108 # the given fps still "work" even if the test changed the cwd.
109 cwd_before = os.getcwd()
110 before_list = [prop(*args, **kwargs)(fp) for fp in fps]
111 f(*args, **kwargs)
112 os.chdir(cwd_before)
113 after_list = [prop(*args, **kwargs)(fp) for fp in fps]
114 for fp, before, after in zip(fps, before_list, after_list):
115 self.assertEqual(
116 before, after,
117 '{0} of file "{1}" changed: from "{2}" to "{3}"'.format(
118 msg, fp, before, after))
119 return wrapper
120 return decorator
121
122
123# Unit tests for file related operations

Callers 2

assert_status_unchangedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected