--liveserver-verbose and --liveserver-debug command-line arguments#1024
Open
mpasternak wants to merge 3 commits intopytest-dev:mainfrom
Open
--liveserver-verbose and --liveserver-debug command-line arguments#1024mpasternak wants to merge 3 commits intopytest-dev:mainfrom
--liveserver-verbose and --liveserver-debug command-line arguments#1024mpasternak wants to merge 3 commits intopytest-dev:mainfrom
Conversation
How to see output from LiveServer when it fails? It was a difficult task, as official Django tests make it quiet... until now.
Author
|
Looks like I can't request review. @bluetech @hramezani I saw you helped with a few recent merges, would you like to check it out? |
--liveserver-verbose and --liveserver-debug command-line argument s
--liveserver-verbose and --liveserver-debug command-line argument s--liveserver-verbose and --liveserver-debug command-line arguments
Author
|
Review required! |
|
Thanks for doing this @mpasternak, I hope it gets merged because it does just work :) I did just try using this locally, and I ran into a problem with the following code: class VerboseLiveServerThread(LiveServerThread):
request_handler_class = VerboseWSGIRequestHandler
def _create_server(self):
return ThreadedWSGIServer(
(self.host, self.port),
self.request_handler_class,
allow_reuse_address=False
)due to this commit to Django: django/django@855f5a3 making a change to how _create_server is called: self.httpd = self._create_server(
connections_override=self.connections_override,
)I fixed it by just adding an optional argument: def _create_server(self, connections_override={}):I don't know if this is the cleanest fix, but it works for me right now :) |
Author
|
Thanks for some kind words. It’s been almost a year since I posted this. Obviously nobody runs into problems with live server except me. And maybe some people on StackOverflow 🤣 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Basing on my usage and on StackOverflow questions, the world needs
--liveserver-verbosecommand line argument, which this branch implements.Default live server is quiet. Django guys made it quiet. And, well, for some, maybe this is good. Because theory says that you're supposed to have a lot of unit tests and when you start integration testing all your code should be A1-OKAY and 100% tested... in an ideal world.
... but in this world, I tend to stumble on "500 ERROR" spewed by LiveServer at my code. Unable to debug, unable to print stuff to the console. Helpless, really. Especially helpless, when I know that everything in the code is okay and the error is because of environment problems. But still, unable to debug it, I feel helpless.
And I don't like the feeling of being helpless.
So I present to you the
--liveserver-verboseargument.It prints stuff on the stdout!
It can even print out a backtrace.
Is it ugly? Yes.
Can it be improved? Yes! Just like pytest-durations, it would be lovely to have some frames and a nicely formatted output.
But... I almost pressed "CREATE PULL REQUEST" here... I can improve it already.
Another option I present to you is
liveserver-debug. This option drops to debugger in the console when a traceback occurs.Am I cool now? Am I the good guy? Can I take constructive criticism? Was I able to do all of that without switches on the command line? LET'S SEE!
What I would really like to see with this branch is how to collect those stdout texts nicely. If I don't use
-sswitch it prints out stderr on failing tests nicely. Perhaps you can help me improve this. Thanks!