Skip to content

Commit a8a9986

Browse files
committed
Fix to hypothesis test framework
A failed EXEC (with error EXECABORT) wasn't resetting the transaction_normalize list. Now commands multi, discard and exec discard it unconditionally.
1 parent 49b479f commit a8a9986

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test_fakeredis_hypothesis.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,6 @@ def _compare(self, command):
418418
for n, r, f in zip(self.transaction_normalize, real_result, fake_result):
419419
assert n(f) == n(r)
420420
self.transaction_normalize = []
421-
elif real_exc is None and command.args and command.args[0].lower() in ('discard', 'exec'):
422-
assert fake_result == real_result
423-
self.transaction_normalize = []
424421
else:
425422
assert fake_result == real_result
426423
if real_result == b'QUEUED':
@@ -429,6 +426,10 @@ def _compare(self, command):
429426
# transaction. But it is extremely unlikely that hypothesis will
430427
# find such examples.
431428
self.transaction_normalize.append(command.normalize)
429+
if (len(command.args) == 1
430+
and isinstance(command.args[0], str)
431+
and command.args[0].lower() in ('multi', 'discard', 'exec')):
432+
self.transaction_normalize = []
432433

433434
@initialize(attrs=attrs)
434435
def init_attrs(self, attrs):

0 commit comments

Comments
 (0)