Skip to content

test: cover osw.utils.util.parallelize - #154

Open
LukasGold wants to merge 1 commit into
mainfrom
test/parallelize-coverage
Open

test: cover osw.utils.util.parallelize#154
LukasGold wants to merge 1 commit into
mainfrom
test/parallelize-coverage

Conversation

@LukasGold

Copy link
Copy Markdown
Contributor

Closes #25

Changes

Adds tests/utils/parallelize_test.py. No production code changes.

Covered:

  • results returned in input order, not completion order
  • kwargs forwarded to the wrapped function
  • empty iterable, and a non-list iterable such as range
  • tasks genuinely run concurrently
  • return_exceptions=False (default): the first exception propagates
  • return_exceptions=True: exceptions land at their own index, neighbours survive, every item is still attempted
  • the already-running event loop path, which is what notebooks hit

The return_exceptions cases are a regression guard for the silent-drop fix in #132.

Note on the concurrency test

It uses a threading.Barrier rather than wall-clock timing: the barrier only clears if all items are in flight at once, so serialized execution fails deterministically instead of flaking under CI load.

Observation, not changed here

Under MODE = "asyncio", both flush_at_end and progress_bar are inert. flush_at_end is only read in the MODE == "dask" block, and the asyncio branch calls tqdm.gather unconditionally without checking progress_bar. The tests deliberately assert nothing about either, so they do not lock in dead behaviour. Worth a separate issue if those parameters should work or be removed.

- result ordering, kwargs forwarding, empty and non-list iterables
- concurrency guarded by a barrier instead of wall-clock timing
- both failure modes: propagate first exception, or collect in place
- the already-running event loop path used from notebooks
- closes #25
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Release preview

No version bump from the current commits (stays at v2.0.2). Use conventional commit types (feat, fix, ...) to trigger a release.

Changelog preview (truncated)

Preview via python-semantic-release and conventional commits.

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.

Write tests for parallelized functions

1 participant