Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
wants to merge 3 commits into from
Closed

Add Python unittest #397

wants to merge 3 commits into from

Conversation

ggorlen
Copy link
Collaborator

@ggorlen ggorlen commented Jun 13, 2022

No description provided.

@ggorlen ggorlen requested a review from kazk June 13, 2022 22:33
@ggorlen
Copy link
Collaborator Author

ggorlen commented Jun 13, 2022

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.
Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

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.

@JohanWiltink
Copy link

JohanWiltink commented Jun 13, 2022

Is it worth encouraging unittest now instead of the CW testing framework (and/or deprecating the latter)?

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.

@ggorlen
Copy link
Collaborator Author

ggorlen commented Jun 13, 2022

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?

@kazk
Copy link
Member

kazk commented Jun 13, 2022

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.

@kazk
Copy link
Member

kazk commented Jun 13, 2022

@ggorlen Please open separate PRs, so it's easier to review and merge individually.

@ggorlen ggorlen closed this Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants