Opened 4 years ago

Last modified 4 years ago

#32489 closed Cleanup/optimization

Add a generator function in runner.py to iterate over a test suite's test cases — at Version 1

Reported by: Chris Jerdonek Owned by: nobody
Component: Testing framework Version: dev
Severity: Normal Keywords: test suite, iterator,
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Chris Jerdonek)

There are four functions or methods in test/runner.py that need to iterate over a test suite's test cases:

Each of these functions is a little harder to understand than it needs to be because each needs to contain the logic of how to iterate over a test suite, which isn't obvious. In particular, they're all implemented as recursive functions, since test suites can contain test suites.

If runner.py contained a single helper function that accepts a test suite instance and returns an iterator of the test suite's test cases, then each of those four functions could be simplified. They could contain a simple for loop over the iterator's return value and not have to be recursive.

The helper function would be pretty simple and could itself be recursive (but it wouldn't need to be). It could be called something like iter_test_cases(suite).

Change History (1)

comment:1 by Chris Jerdonek, 4 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top