Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Management Command Database Locking #219
Management Command Database Locking #219
Changes from all commits
f46b58d
7fbcc8a
7b14b13
f8b4e3d
d99eb55
0dac7fc
283be5e
0141043
2e2ea05
214fdd7
4c6c211
a8e7ee4
3773b3d
d44a413
5dbedfe
3791ef2
9e91f5c
bd82a49
f202ab2
5633425
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://docs.djangoproject.com/en/4.0/ref/django-admin/#output-redirection, you should be able to capture stderr with the
stderr=
param ofcall_command
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and it didn't work.
It turns out for that to work the Command implementer has to explicitly send prints to print("blah", stderr=self.stderr), where self is BaseCommand. And I think these messages aren't even coming from python, but the underlying xapian database implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the underlying xapian database implementation is probably where all this file locking nonsense should be, but I digress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the failure mode for this test is only occasionally parsing that stderr string. Most of the time call_command() throws an exception and halts the test before the assert.