comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

Convert the tests to use pytest

Open cfarrow opened this issue 8 years ago • 3 comments

From the discussion in #121.

cfarrow avatar Mar 22 '17 13:03 cfarrow

I would definitely like to use a more conventional test runner for comtypes, and pytest is the latest and greatest. However, I'd prefer the test code to not depend on pytest, primarily because comtypes does not currently require any external packages to run (most of) the tests. In other words, I think it's best to bring the tests to a state where python -m unittest comtypes works, and then use pytest as a test runner, code coverage, etc.

What do others think?

cfarrow avatar Mar 22 '17 13:03 cfarrow

One of the best features of pytest is the composability that using fixtures bring as well as nice simple assert x == y syntax. But after looking through the current tests it seems that fixtures won't be too useful, so perhaps just standard unittest tests are fine.

I wouldn't be scared of adding test dependencies though, for example the find_memleak.py could be considerably shorter and more readable if psutil was used.

One last thing, I think it would be good to separate the tests out into two types: automated and manual. For example there should definitely be a test for automating Microsoft Word/Excel as this is one of the main reasons people use comtypes, but running those on the CI server is impossible. However over COM tests like the Internet Explorer ones can be automated for sure, and the manual ones just have to be perhaps run before a release.

orf avatar Mar 22 '17 13:03 orf

+1 for of breaking up the tests cleanly into automated and manual tests. Also for using psutil for the memory leak tests. Those tests are very unreliable.

Ultimately, anything that cleans up the tests and makes them easier to write and maintain is a good thing. pytest is easy to install, so I'm not overly worried about introducing it if we're bringing psutil in as a dependency as well.

cfarrow avatar Mar 27 '17 12:03 cfarrow

@cfarrow @orf

This issue has not been in motion for years.

Time has passed since this issue was submitted, and with contributions to improve the test, including #267, #271 and #298, the situation is much different now than it was then.

There is also a more comprehensive discussion in #480 on whether we should introduce modern tools such as pytest.

So, I will close this issue, and redirect the discussion to #480.

Thank you.

junkmd avatar Jun 19 '23 13:06 junkmd