Skip to content

fix: guard set_start_method against duplicate calls (GH-466)#483

Open
tomrussobuilds wants to merge 1 commit intoboxed:mainfrom
tomrussobuilds:fix/guard-set-start-method
Open

fix: guard set_start_method against duplicate calls (GH-466)#483
tomrussobuilds wants to merge 1 commit intoboxed:mainfrom
tomrussobuilds:fix/guard-set-start-method

Conversation

@tomrussobuilds
Copy link

Fixes #466

When mutmut is invoked via the entry-point wrapper (mutmut run),
mutmut.__main__ is cached in sys.modules and not re-executed.
When invoked via python -m mutmut run, the module is re-executed,
causing set_start_method("fork") to raise RuntimeError: context has already been set.

Guard with get_start_method(allow_none=True) and emit a warning
when the module is re-executed.

When mutmut is invoked via the entry-point wrapper (`mutmut run`),
`mutmut.__main__` is cached in `sys.modules` and not re-executed.
When invoked via `python -m mutmut run`, the module is re-executed,
causing `set_start_method("fork")` to raise `RuntimeError: context
has already been set`.

Guard with `get_start_method(allow_none=True)` and emit a warning
when the module is re-executed.
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.

[BUG] Context already been set

1 participant