Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to integrate dape with pytest? #79

Open
liullo opened this issue Mar 2, 2024 · 5 comments
Open

How to integrate dape with pytest? #79

liullo opened this issue Mar 2, 2024 · 5 comments

Comments

@liullo
Copy link

liullo commented Mar 2, 2024

I've searched the web, and can not find a solution to integrate dape with pytest. Can anyone give me some ideas about the workflow for testing and debugging? Thanks.

@svaante
Copy link
Owner

svaante commented Mar 5, 2024

Hey I just pushed an batteries included config that works great with pytest, so you need to use the latest commit for this to work.

It's called `debugpy-module', see screenshot for usage (note that "User Uncaught Exceptions" need to be enabled to break at assertion error).

debugpy-module :module "pytest"

bild

@liullo
Copy link
Author

liullo commented Mar 7, 2024

Great work! Thanks for your reply! But it did not break at any assertion error or breakpoint even when the "User Uncaught Exceptions" was enabled. What was I missing?

@svaante
Copy link
Owner

svaante commented Mar 7, 2024

Would you mind share some additional information?

  1. (setq dape-debug t)
  2. Start debugpy-module :module "pytest"
  3. Share the contents of *dape-connection events* buffer

@johannes-mueller
Copy link

I've searched the web, and can not find a solution to integrate dape with pytest. Can anyone give me some ideas about the workflow for testing and debugging? Thanks.

Maybe take a look at test-cockpit.el which for python/pytest now supports to run the last pytest run as a dape debug session. I would like to encourage you to give it a try and give feedback.

@Peter-Chou
Copy link

I accidently figured out that you can use dape to debug specific test function in specific test file by simply runing this command:

debugpy-module :module "pytest" :args ["test_file_relative_path_to_base_project::test_method_name"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants