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

Tests: sort custom loaded tests #1851

Merged
merged 2 commits into from
May 31, 2023
Merged

Tests: sort custom loaded tests #1851

merged 2 commits into from
May 31, 2023

Conversation

Berserker66
Copy link
Member

What is this fixing or adding?

Sorts tests by folder, resulting in less categories created from our custom loader. Possibly only visible in PyCharm?

How was this tested?

If this makes graphical changes, please attach screenshots.

turns
image
into
image

suite.addTests(loader.discover(folder, top_level_dir=file_path))
for test_collection in loader.discover(folder, top_level_dir=file_path):
for test_suite in test_collection:
for test_case in test_suite:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this use all_tests.extend(test_suite) to avoid one level of nesting?

@@ -8,7 +8,13 @@ def load_tests(loader, standard_tests, pattern):
suite.addTests(standard_tests)
folders = [os.path.join(os.path.split(world.__file__)[0], "test")
for world in AutoWorldRegister.world_types.values()]
all_tests = []
for folder in folders:
if os.path.exists(folder):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would invert this if due to the very high nesting in this section

Copy link
Member

@black-sliver black-sliver left a comment

Choose a reason for hiding this comment

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

code looks good, assuming you tested

@ThePhar ThePhar added is: refactor/cleanup Improvements to code/output readability or organizization. affects: core Issues/PRs that touch core and may need additional validation. labels May 31, 2023
@Berserker66 Berserker66 merged commit fad0fe1 into main May 31, 2023
@Berserker66 Berserker66 deleted the tests_load_order branch May 31, 2023 23:44
Berserker66 added a commit that referenced this pull request Jun 20, 2023
kindasneaki pushed a commit to kindasneaki/Archipelago that referenced this pull request Jun 28, 2023
FlySniper pushed a commit to FlySniper/Archipelago that referenced this pull request Nov 14, 2023
Jouramie pushed a commit to Jouramie/Archipelago that referenced this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: refactor/cleanup Improvements to code/output readability or organizization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants