Skip to content

Commit 4ae307f

Browse files
committed
Making a few fixes based on PR feedback
1 parent 47cb3e9 commit 4ae307f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/integration/cqlengine/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ def wrapped_function(*args, **kwargs):
9090
count.get_counter()
9191
# DeMonkey Patch our code
9292
cassandra.cqlengine.connection.execute = original_function
93+
# Check to see if we have a pre-existing test case to work from.
94+
if len(args) is 0:
95+
test_case = unittest.TestCase("__init__")
96+
else:
97+
test_case = args[0]
9398
# Check to see if the count is what you expect
94-
tc = unittest.TestCase("__init__")
95-
tc.assertEquals(count.get_counter(), expected, "Expected number of cassandra.cqlengine.connection.execute calls doesn't match actual number invoked Expected: {0}, Invoked {1}".format(count.get_counter(), expected))
99+
test_case.assertEqual(count.get_counter(), expected, msg="Expected number of cassandra.cqlengine.connection.execute calls doesn't match actual number invoked Expected: {0}, Invoked {1}".format(count.get_counter(), expected))
96100
return to_return
97101
# Name of the wrapped function must match the original or unittest will error out.
98102
wrapped_function.__name__ = fn.__name__

0 commit comments

Comments
 (0)