Skip to content
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

Adjust the log_path DeprecationWarning's stack level #6274

Closed
edmorley opened this issue Aug 12, 2018 · 4 comments
Closed

Adjust the log_path DeprecationWarning's stack level #6274

edmorley opened this issue Aug 12, 2018 · 4 comments
Labels

Comments

@edmorley
Copy link

Meta -

OS: Windows 10
Selenium Version:
Browser: Firefox
Browser Version: 63.0a1

Expected Behavior -

That the DeprecationWarning added in #5979 sets an appropriate stacklevel, so that the warning references the offending caller, and not the file + line number of where the logger.warn() is called.

Actual Behavior -

stacklevel not used, so the stack trace doesn't point at the offending caller:

        if log_path:
>           warnings.warn('use service_log_path instead of log_path', DeprecationWarning)
E           DeprecationWarning: use service_log_path instead of log_path
../../../venv/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py:104: DeprecationWarning

Steps to reproduce -

Update a project using pytest-selenium 1.13 from selenium 3.13.0 to 3.14.0 with DeprecationWarnings as errors. eg:
mozilla/treeherder#3872
https://travis-ci.org/mozilla/treeherder/jobs/411325051#L947

@lmtierney
Copy link
Member

Currently none of our DeprecationWarning warnings have a stacklevel different than default. I'm not against changing this, but if we do it for service_log_path we should probably do it for all of them.

Thoughts @AutomatedTester ?

@lmtierney lmtierney added the C-py label Aug 13, 2018
@AutomatedTester
Copy link
Member

Sounds good to me, as more people start hiding Selenium in their packages it's going be required more.

@lmtierney
Copy link
Member

Added stacklevel=2 to all DeprecationWarning via 18681a6

@edmorley
Copy link
Author

Many thanks :-)

@lock lock bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants