-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
I believe the following test should pass :-
import fixture
import unittest
class TestFixt (fixture.loadable.LoadableFixture):
'''Create an empty fixture class which doesn't apply anything'''
def attach_storage_medium(self,ds): pass
def rollback(self,): pass
def commit(self,): pass
dbfixture = TestFixt()
fixture_tables = []
class SillyTests(unittest.TestCase):
@dbfixture.with_data(*fixture_tables)
def test_something_inane(self,fixt =None):
self.assertNotEqual(fixt,None,"Fixture not applied")
if __name__ == "__main__":
unittest.main()However instead of passing in raises an exception AttributeError: <SuperSet at 0x1389690 with keys []> has no attribute 'assertNotEqual' this is due to the fixture being prepending to args (rather than the more usual append) and taking the of the self parameter.
I'd suggest changing the with_data to append , but that risks breaking existing users, so I suggets one of two possibilities.
- A new decorator which is identical to with_data but appends, rather than prepends the fixture,
- Modifying with_data to insert the fixture after the first argument if the first argument exists and and is an instance of unittest.Testcase .
I think overall I prefer the first but I've got some PoC code for the second.
Metadata
Metadata
Assignees
Labels
No labels