Workaround for debug python console evaluating all class properties?

I use PyCharm to test a website using playwright and custom page object models I've written. My classes have many properties for getting values from the displayed page. I often set breakpoints in my code to see the state of the website and determine ways to find and interact with elements.

I'm running PyCharm version 2022.3.3, and because of, when I use the debug console, every property is evaluated when I try to interact with my page object. This is not only extremely slow, but causes side effects in the page and has completely derailed my ability to create and debug my tests.

Are there any workarounds for this issue so that I can continue developing my tests in PyCharm?

Comment actions Permalink

Unfortunately, I'm not aware of the workaround. Could you please specify which side effects does evaluation of properties have?

As I understand, the best practice for using properties is that the code under the `@property` decorator should only access and return values, not modify something. When you need to modify something, it is better to use methods instead.
Comment actions Permalink

I thought I posted a response, but I don't see it -- basically, my class has a large number of properties that require interaction with elements on a web page. Reloading all of them is expensive.

It's also worth noting that because I interact with a web page and external servers, it took me a long time to determine that the issues I was having were related this change in PyCharm, and not something wrong with my tests or the systems I was testing.


Please sign in to leave a comment.