Skip to content

Conversation

@fatelei
Copy link
Contributor

@fatelei fatelei commented Oct 12, 2025

gh-131178: add unittest for turtledemo command line interface

@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Oct 12, 2025
@bedevere-app

This comment was marked as resolved.

@fatelei fatelei force-pushed the turtledemo_ut branch 3 times, most recently from d4e86b8 to e835630 Compare October 12, 2025 05:25
@python python deleted a comment from bedevere-app bot Oct 12, 2025
@python python deleted a comment from bedevere-app bot Oct 12, 2025
@terryjreedy terryjreedy self-requested a review October 12, 2025 06:15
@python python deleted a comment from bedevere-app bot Oct 12, 2025
Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you creating a faux unittest? Please use the actual module, I suggest you look at the many other tests in Lib/test/.

- Clean up trailing spaces on all lines
- Maintain proper code formatting and readability
- All tests continue to pass successfully
@terryjreedy
Copy link
Member

I am closing this. The immediate problem with the proposed tests is that they catch assert failures and then fail. This is not how unittests should be written.

The bigger problem is that turtledemo is not a library module. It is a GUI app that serves as dynamic documentation of turtle library features. Its command line interface is empty in the sense that there are no command line options to test. But the minimal CLI of running the file is not tested -- and should not be.

Testing library module CLIs meaning running the module with various arguments and testing that the stdout and possibly stderr output matches expectations. Turtledemo has instead an interactive user interface. Running it displays the GUI app, which then waits for user mouse clicks. There is no text output and would be no graceful way to close it from a unittest.

Testing a GUI is entirely different from testing a CLI, and turtledemo is not designed for automated unit testing. It has to be manually tested, which I have done extensively. Anyone touching it should do the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants