Skip to content

Commit

Permalink
Somewhat clarify multiprocessing misadventure
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed Mar 29, 2024
1 parent 602de0c commit d4b50c9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/deprecation/test_cmd_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,8 @@ def test_use_shell_cannot_set_on_instance(
instance.USE_SHELL = value


def _check_use_shell_in_worker(value: bool) -> None:
# USE_SHELL should have the value set in the parent before starting the worker.
assert Git.USE_SHELL is value

# FIXME: Check that mutation still works and raises the warning.
def _get_value_in_current_process() -> bool:
return Git.USE_SHELL


@pytest.mark.filterwarnings("ignore::DeprecationWarning")
Expand All @@ -220,8 +217,8 @@ def test_use_shell_preserved_in_multiprocessing(
"""The USE_SHELL class attribute pickles accurately for multiprocessing."""
Git.USE_SHELL = value
with ProcessPoolExecutor(max_workers=1) as executor:
# Calling result() marshals any exception back to this process and raises it.
executor.submit(_check_use_shell_in_worker, value).result()
marshaled_value = executor.submit(_get_value_in_current_process).result()
assert marshaled_value is value


_EXPECTED_DIR_SUBSET = {
Expand Down

0 comments on commit d4b50c9

Please sign in to comment.