Xion / pyqcy

QuickCheck-like testing framework for Python
http://xion.io/pyqcy
Other
41 stars 0 forks source link

Integration with mocktest #21

Closed beloglazov closed 12 years ago

beloglazov commented 12 years ago

Hi Karol,

I've tried using pyqcy together with mocktest, but faced a couple of problems. The first problem is that mocktest requires the usage of its own subclass of TestCase, whereas pyqcy uses a subclass of TestCase to run tests for example with nosetests. A quick fix for me was to modify pyqcy's TestCase to inherit from mocktest.TestCase instead of unittest.TestCase. Here is the modified version: https://gist.github.com/3337633

This fix enables both pyqcy with nosetests and mocktest. Is there a more general way of this kind of integration without mocktest specific modifications?

Thanks, Anton

Xion commented 12 years ago

Did you try inheriting from both, with pyqcy.TestCase being first? Alternatively, you could drop inheritance of mocktest.TestCase altogether and just call MockTransaction.enter() in setUp(), and MockTransaction.exit() in tearDown(). I believe I did something like this the last time I used mocktest and it worked fine.

beloglazov commented 12 years ago

Thanks for the suggestion: setUp and tearDown worked. However, the other problem (https://github.com/Xion/pyqcy/issues/22) remained. As I posted in that thread, the solution using with MockTransaction: works.

Xion commented 12 years ago

Right. And I think it's more convenient to keep all mocktest-related talk in one thread, so I'll be closing this issue and suggest to bring the discussion to the other one.