inducer / inducer/pudb

Adding arbitrary logic to determine if PuDB stops

Open
#241 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.2k
Forks
245
Avg merge
13m
Merged PRs (30d)
5

Description

I'm building a solution for my team to run tests and debug them. Tests are run by pytest and PuDB is the debugger. I use `pytest-pudb` to launch pudb, but I want to switch from it because I want PuDB to pause not only on an exception, but I want it to pause immediately when Pytest reaches the first line of the test. (i.e. after it's done with all the Pytest bureaucracy.)

I'm thinking, how can I accomplish this? Now that PuDB is able to start paused ( #234 ) I'll be able to start PuDB, but I want it to stop on the first line of the test. Our test framework only runs one test in a single run. Currently the only solution I can think of is to programmatically figure out the code file and line number of the test, and then set a breakpoint there. But that is really cumbersome and fragile.

I wish PuDB had some way of letting me give it a condition. i.e. "next time you step into a file in the folder /foo/bar whose name starts with test_, pause, and then cancel this condition." Of course, this specific condition is tailor-made to my problem and it's very unlikely to be useful for others. But, maybe PuDB could accept arbitrary conditions? i.e. it'll have an API where I can give it a function, and then on every line it calls that function, and if it returns `True`, PuDB pauses, and if `False` it doesn't. Then anyone could put their complex logic in that function.

What do you think?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.