-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
code/source: some cleanups #7438
Commits on Jul 1, 2020
-
code/source: expose deindent kwarg in signature
Probably was done to avoid the shadowing issue, but work around it instead.
Configuration menu - View commit details
-
Copy full SHA for 2fe1784 - Browse repository at this point
Copy the full SHA 2fe1784View commit details -
code/source: remove Source(deindent: bool) parameter
Not used, except in tests.
Configuration menu - View commit details
-
Copy full SHA for 4108174 - Browse repository at this point
Copy the full SHA 4108174View commit details -
code/source: remove old IndentationError workaround in getsource()
This has been there since as far as the git history goes (2007), is not covered by any test, and says "Buggy python version consider upgrading". Hopefully everyone have upgraded...
Configuration menu - View commit details
-
Copy full SHA for c6083ab - Browse repository at this point
Copy the full SHA c6083abView commit details -
code/source: remove unneeded assert
inspect.getsource() definitely returns str.
Configuration menu - View commit details
-
Copy full SHA for c83e16a - Browse repository at this point
Copy the full SHA c83e16aView commit details -
code/source: remove support for passing multiple parts to Source
It isn't used, so keep it simple.
Configuration menu - View commit details
-
Copy full SHA for 2b99bfb - Browse repository at this point
Copy the full SHA 2b99bfbView commit details -
code/source: remove support for comparing Source with str
Cross-type comparisons like this are a bad idea. This isn't used.
Configuration menu - View commit details
-
Copy full SHA for a127a22 - Browse repository at this point
Copy the full SHA a127a22View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7303b5 - Browse repository at this point
Copy the full SHA a7303b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4a27d7d - Browse repository at this point
Copy the full SHA 4a27d7dView commit details -
skipping: use plain compile() instead of _pytest._code.compile()
eval() is used for evaluating string conditions in skipif/xfail e.g. @pytest.mark.skipif("1 == 0") This is the only code that uses `_pytest._code.compile()`, so removing its last use enables us to remove it entirely. In this case it doesn't add much. Plain compile() gives a good enough error message. For regular exceptions, the message is the same. For SyntaxError exceptions, e.g. "1 ==", the previous code adds a little bit of useful context: ``` invalid syntax (skipping.py:108>, line 1) The above exception was the direct cause of the following exception: 1 == ^ (code was compiled probably from here: <0-codegen /pytest/src/_pytest/skipping.py:108>) (line 1) During handling of the above exception, another exception occurred: Error evaluating 'skipif' condition 1 == ^ SyntaxError: invalid syntax ``` The new code loses it: ``` unexpected EOF while parsing (<skipif condition>, line 1) During handling of the above exception, another exception occurred: Error evaluating 'skipif' condition 1 == ^ SyntaxError: invalid syntax ``` Since the old message is a minor improvement to an unlikely error condition in a deprecated feature, I think it is not worth all the code that it requires.
Configuration menu - View commit details
-
Copy full SHA for 9640c9c - Browse repository at this point
Copy the full SHA 9640c9cView commit details -
code/source: remove compiling functions
A lot of complex code that isn't used anymore outside of tests after the previous commit.
Configuration menu - View commit details
-
Copy full SHA for ef39115 - Browse repository at this point
Copy the full SHA ef39115View commit details -
code/source: inline getsource()
The recursive way in which Source and getsource interact is a bit confusing, just inline it.
Configuration menu - View commit details
-
Copy full SHA for f5c69f3 - Browse repository at this point
Copy the full SHA f5c69f3View commit details
Commits on Jul 4, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 40301ef - Browse repository at this point
Copy the full SHA 40301efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 11efe05 - Browse repository at this point
Copy the full SHA 11efe05View commit details