1

I have a test that is parameterized that is only failing when running in parallel, so I want to be able to run it and to put a breakpoint and start debugging when it reaches a certain portion of the code. My problem is that PyCharm Pro 2023.1 isn't stopping at the breakpoint. The only way it stops is when I change the run parameters to remove parallel testing (-n0), which makes my test pass...

Here is my simplified code:

@pytest.mark.parametrize('url', ['url1', 'url2', 'url3'])
def test_list_all_urls(self, url):
    print(url). # <----- This is where I put a breakpoint in PyCharm

When I hit DEBUG in PyCharm, I would expect it to stop at the very first line of my test, but it simply ignores the breakpoint.

Is there anything I can do to make PyCharm honor my breakpoint in a pytest running with -n 2?

Ben
  • 21
  • 2
  • are you using any fixtures in different scopes ? from my experience thats cause the problem – ozs Apr 18 '23 at 06:40
  • No. Even the simple test above without anything else loaded is failing to break as soon as I add -n 2. – Ben Apr 19 '23 at 21:56
  • why do you have "self" in the method ? is it under class ? – ozs Apr 20 '23 at 07:47
  • My bad, I since removed the class completely and the self but it was originally under a class. – Ben Apr 21 '23 at 15:28

0 Answers0