-
Notifications
You must be signed in to change notification settings - Fork 223
Add Python unittest #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Python unittest #397
Conversation
Is it worth encouraging unittest now instead of the CW testing framework (and/or deprecating the latter)? |
|
||
import ThemedImage from "@theme/ThemedImage"; | ||
|
||
Codewars offers Python's [unittest](https://docs.python.org/3/library/unittest.html) module for testing solutions. Codewars uses a custom reporter for unittest to format the output for the code runner. Visit the [python-test-framework](https://github.com/codewars/python-unittest) GitHub repository for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't support unittest
to test kata solutions. It's only supported in Kumite. It happens to work if you add unittest.main(testRunner=CodewarsTestRunner())
because the test is run with python tests.py
. The runner still does stuff like prepending import codewars_test as test
because it's asked to use the Codewars test framework.
I really want to make test framework configurable per kata and stop using the custom test framework though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, maybe I got excited too soon! Can I use this to test, for example, Pandas challenges, or is it recommended to stick with CW test framework?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just remembered we discussed this a few years ago. codewars/python-test-framework#7 (comment)
I don't want to recommend using unittest
now, but if you need it, I guess it's fine to use it with a comment at the top explaining the hack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I saw your recent push in exo and figured it was an option with 3.10.
After people fixed thousands upon thousands Python kata for the last framework, modules, and Python 3.10, I'm not sure if deprecating any of that so soon will go over well. |
Also, I notice many testing frameworks are missing guides. I can add these pretty easily from Qualified's docs, but maybe I should defer to someone more familiar with the platform? |
No, we can review them and suggest changes if it's awkward in Codewars context. PRs welcomed. |
@ggorlen Please open separate PRs, so it's easier to review and merge individually. |
No description provided.