Open ChillarAnand opened 1 year ago
Agreed, I was surprised we didn't have a feature request open for this. This was previously attempted at #145 but abandoned. This would make for a good feature. If you'd like to implement it, go ahead.
What is the desired behavior?
Is the desire for the code python -m pysnooper user_script.py
to run the test for the whole file similarly to @pysnooper.snoop()
before every function in the code?
Should this command run the test just for the first function in the user_script?
Maybe this command should run the test just for the __main__()
function in the user_script
?
I tried thinking about implementing this feature, but I'm not sure what this command should do.
Hello Itay and welcome to the project.
The desired behavior is to snoop the entire file, regardless of whether it has any tests, a __main__
function or any other functions defined.
Essentially it should be as if someone put a line snoop(argumes).__enter__()
before the file. (Untested, treat as pseudocode.)
@ChillarAnand if you have some time I'd like for input about my draft in #254, it works with simple local tests I've written but nothing can beat real-world application.
@cool-RR Can you assign this issue to me?
PySnooper has a wide variety of use cases. One of the limitations is not being able to use it without modifying the script.
It would be great if the
-m
flag is added to run it as a module.