-
Notifications
You must be signed in to change notification settings - Fork 15
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
Testing psygnal with pytest-qt #319
Comments
Just answered myself by checking the local unit tests and the answer seems yes. Closing. |
Yep! As you found, it works. I'll also note the long standing #46 "todo"... but that hasn't been urgent for me since I too just use pytest-qt in most cases |
Another test pattern for synchronous applications is to connect your signal to a Mock(), perform your action, and then use mock.assert_called... |
Do you have an example I can look at? |
yeah, that pattern is used all throughout the tests in this repo, for example: Lines 109 to 120 in 8f4d781
(note, it really doesn't need to be |
Ah so you're mixing both unittest and pytest together. Clever, I might pick up on that since in the end I'm also using mock objects to test my logic. Thanks! |
yeah, one doesn't need to be using unittest as a test runner to take advantage of |
For a project I'm working on, I'm using psygnal as signaling mechanism within my application. I would like to run unit tests on some internal parts of my project to ensure everything works properly. Is it possible to use pytest-qt together with psygnal to run unit tests and ensure that signals are correctly emitted?
The text was updated successfully, but these errors were encountered: