Effective PyCharm (2021 edition) Transcripts
Chapter: Unit testing
Lecture: Debugging tests

Login or purchase this course to watch this video and the rest of the course contents.
0:00 I made a slight change to our failing tests so that it will actually pass,
0:04 go back and change this less than two greater than if you'd like to see it
0:07 fail. I just want to make sure we can have all of our tests for
0:10 this project passing. But I also made it use a random number here.
0:14 Why is that? Because I want to actually show you the ability to debug it
0:17 Like what if we need to know what is going on in this test.
0:21 Normally you might just run pytest from the CLI or something like that.
0:26 I would like to know exactly what is happening here so we can do a couple
0:31 of things. First notice that we can just run individual tests by right there by
0:35 clicking it. I could say run this will actually create a nude run configuration up
0:40 there. I could equally run this one and look the test,
0:45 change the fails passing. But if I put a breakpoint here,
0:48 I can click the debug there,
0:51 I can go over in this and click the debug there.
0:53 Or I can just click the debug here.
0:55 Once I have it running either the individual or all of them And we go and
1:01 look at that right now. Number is 179.
1:05 So if you want to focus in and actually debug these things,
1:08 we already saw how awesome the PyCharm debugger is.
1:12 Well there's a super easy way to figure out why your test might be failing. Set a break point.