-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
GD-607: Fix discovery of root test suites #604
Conversation
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.
Looks good, please add test coverage for the new code path you implemented.
Thank you for the guidance! I'll see about structuring this properly soon. |
Thank you for creating and assigning the error problem. To finally fix the bug, please add the missing test case. Thank you again for your work. |
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.
Sorry, but we should avoid default arguments here.
@esainane do you continue here? |
I do. My apologies for the delay, I should be free to finish this up shortly. |
The gdUnit4 settings description for `Test Lookup Folder` states: > Subfolder where test suites are located (or empty to use source folder directly) However, leaving this setting empty (or set to /, or res://) will cause gdUnit4 to not find any test suites in the root folder. `scan_test_directories` starts by examining subfolders, though it is very permissive with any of these test directory settings. This refactors external calls to `scan_test_directories` into a `scan_all_test_directories` instead, which performs the common call if any specific test directory is set, and returns the base directory otherwise. With this change, it will now correctly pick up a `[TestSuite]` annotated class at `res://Test.cs`. This would still be bad practice in a proper project, since it has to perform a lot of scanning which a dedicated test directory would avoid. However, this should eliminate much confusion when trying to create a minimal reproducible test project and wondering why the test suite is silently not being detected.
`scan_all_test_directories` will still retrieve the value from settings if not otherwise specified.
9189572
to
959b9b1
Compare
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.
Good job!
Why
The GdUnit4 Godot Editor plugin currently does not find any tests in the project root directory, even when configured to do so.
Fixes #607.
What
scan_test_directories
into a newscan_all_test_directories
instead. These external calls all had the formscan_test_directorys("res://", GdUnitSettings.test_root_folder(), [])
. This provides a cleaner API, and a logical place to add handling for the "include all resources" special case.scan_all_test_directories
is called to determine which resource paths should be included, and the project is configured to include all resources, it early returns["res://"]
. Otherwise, it performs the current subfolder scanning logic viascan_test_directories("res://", GdUnitSettings.test_root_folder(), [])
.suits
->suites
scan_test_directorys
->scan_test_directories