pytest icon indicating copy to clipboard operation
pytest copied to clipboard

Multiprocessing Issue

Open roshant-ska opened this issue 1 year ago • 2 comments

  • [x] a detailed description of the bug or problem you are having
  • [x] output of pip list from the virtual environment you are using
  • [x] pytest and operating system versions
  • [x] minimal example if possible

roshant-ska avatar Feb 16 '24 15:02 roshant-ska

Pytest version: 7.4.4 OS: Ubuntu 22.04 LTS I am facing below issues when using Proces, Manager, Queue modules from multiprocessing package. Issue 1: When running unit test case with make python-test job, when I press CNTRL+C, the the processes created with pytest remains there and does not terminate on its own.

Issue2: In integration test case, though the test case gets passed the pod created for pytest does not terminate and remains there.

The destructor code is as below: self.process_manager.shutdown() self.sub_process.terminate() self.sub_process.join()

After removing the multiprocessing modules pytest behaves normally.

Please guide in this regard to handle the multiprocessing with pytest. Please let me know if more inputs required. Awaiting for your response. Regards.

roshant-ska avatar Feb 16 '24 15:02 roshant-ska

@roshant-ska pytest just executes the test functions, if they never return then pytest will get stuck.

Can you post a minimal example reproducing the problem? Multiprocessing is a complex topic, and many many things can go wrong, so we need to discuss solutions over a MWE.

nicoddemus avatar Feb 17 '24 20:02 nicoddemus

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] avatar Mar 03 '24 01:03 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Mar 10 '24 01:03 github-actions[bot]