Skip to content
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

Making the test run, when the script is run. #3762

Closed
wants to merge 1 commit into from

Conversation

Ornataweaver
Copy link

Without unitest.main(), the tests wouldn't run.

Please consider explaining to the student why the if statement is necessary, and why it checks if the name is __main__.
9 years ago I didn't understand this, I just found out about modules, and I'm very excited to share this.

Thank you. 🍇

Without unitest.main(), the tests wouldn't run.
Please consider explaining to the student why the if statement is necessary, and why is the name __main__.
Thank you. 🍇
Copy link
Contributor

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Aug 26, 2024
@BethanyG
Copy link
Member

Hi @Ornataweaver 👋🏽

As the comments on your forum post imply, this was an on-purpose decision.

We used to use if __name__ == __main__ in our test files, but since the decision was made to use pytest for our online test runner and pytest syntax for our learning exercises, we've pointed students to installing and using pytest for testing. We retain the unittest syntax for now in test files, but might move to all-pytest syntax in the future.

If students so choose, they can add that block back to tests (although it won't work for learning exercises) themselves. but we don't support/encourage it, since it is a poorly understood feature for beginners to use and we do not yet have any learning exercises around it.

@Ornataweaver
Copy link
Author

Thank you so much for putting the time and care. @BethanyG 🙏🏻

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.

2 participants