anfema / integrate

Python integration test framework
BSD 3-Clause "New" or "Revised" License
39 stars 7 forks source link

Base classes are discovered like tests #2

Closed withrocks closed 6 years ago

withrocks commented 6 years ago

Hi! I've been looking for a framework that does exactly this - looks good!

I tried creating a test, but one that inherits from a subclass of your TestCase, e.g. called BaseTestCase. I do this as I want several of my test cases all to use the same setup_all method. Now, when my test runs, the BaseTestCase also gets discovered, and its setup_all method runs. (Since I'm using setup_all to setup my Selenium driver, it means that the browser instance is started twice.)

This could easily be resolved with some kind of naming convention. But I assume a better way would be to discover all the test cases like before, then skip the ones that are superclasses of any of the other test cases.

So in my case, if what gets discovered is [BaseTestCase(TestCase), SomeRealTestCase(BaseTestCase)], the framework would see that BaseTestCase is actually a superclass of SomeRealTestCase, and would finally return only [SomeRealTestCase(BaseTestCase)]. If that sounds good to you I can throw in a PR.

Have a good day.

withrocks commented 6 years ago

It seems that this does the trick: https://github.com/anfema/integrate/pull/3

Please tell me what you think.

dunkelstern commented 6 years ago

Merged the pull request, closing