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
PR #25502 breaks manually run unittests #25613
Comments
This just looks like there's no |
Can you maybe print value of sys.stderr just before that line to see if it's tempered with by some library/tool.
We also use coverage.py but our tests are passing fine - https://github.com/frappe/frappe/actions/runs/8397844336 |
We are registering a signal handler. When SIGUSR1 is sent to process we dump stacktrace to |
The only real difference I see is us using This is the output with your print statement: <xmlrunner.result._DuplicateWriter object at 0x7f220a94d4b0> <class 'xmlrunner.result._DuplicateWriter'> Edit: |
For now, we monkey patch |
This is a good idea to add to core - running tests without bench. |
unittest
unittest
) * fix: register faulthandler on true stderr only #25613 (cherry picked from commit a49189a) * fix: response logging if response is 4xx then `Response` object itself is getting logged, which is stupid. This is because of `res and res.text` and res is falsy if response is not "OK". (cherry picked from commit 4c85c20) --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
) * fix: register faulthandler on true stderr only #25613 (cherry picked from commit a49189a) * fix: response logging if response is 4xx then `Response` object itself is getting logged, which is stupid. This is because of `res and res.text` and res is falsy if response is not "OK". (cherry picked from commit 4c85c20) --------- Co-authored-by: Ankush Menat <ankush@frappe.io>
Description of the issue
PR #25502 broke our unittests. The corresponding issue is #25496. (I actually don't understand what's going on here)
We run unittests with coverage for our app with the following command and upload the results to GitLab (so this is run through a GitLab CI pipeline). The problem can be recreated locally with the same command:
python -m coverage run --source ../apps/<our_app>/<our_app> -m xmlrunner discover -v -s ../apps/<our_app>/<our_app> -p test_*.py --output-file "$UNITTEST_XML_RESULTS_FILE"
This worked great with frappe 12, 13 and 14 until you merged the PR #25502.
Context information (for bug reports)
Output of
bench version
Steps to reproduce the issue
We have inherited our own class from FrappeTestCase and added a
frappe.init
(and other small necessary stuff) to it to be able to run each unittest individually.Yes, this is possible through
bench run-tests
, but we want to use the functionality integrated into VSCode to have visual feedback for each unittest and be able to debug them properly (see https://code.visualstudio.com/docs/python/testing, works like a breeze and we will never want to loose this).Running the unittests integrated into VSCode poses no problem btw., but this has to do with the fact that the integrated ones only use
unittest
, and notcoverage
andxmlrunner
.So for reproduction you need to use the following class for your unitttests and run the aforementioned command:
Observed result
Unittests run without a problem.
Expected result
The first unittest crashes.
Stacktrace / full error message
Slightly adjusted to omit our app:
Additional information
We would be happy to throw away our customizations if there is any other sane and integrated way to run and debug each unittest individually through VSCode.
The text was updated successfully, but these errors were encountered: