Skip to content

remove log_path and use service_log_path consistently instead #180

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

Merged
merged 6 commits into from
Aug 17, 2018

Conversation

BeyondEvil
Copy link
Contributor

Fixes #179

@@ -24,7 +24,7 @@ def testdir(request, httpserver_base_url):
if 'testdir' not in item.funcargnames:
return

testdir = request.getfuncargvalue('testdir')
testdir = request.getfixturevalue('testdir')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was caught when running with DeprecationWarning enabled. @davehunt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BeyondEvil. This was introduced in pytest 3.0.0, which we already depend on, so this is a very safe change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to be a pain and ask you to split this (and a few other things) out into a separate commit or pull request. This shouldn't break anything for anyone, but if it does it makes it easier to identify if it's not combined with an unrelated change.

failure('--capability', 'browser_api_name', 'FF46')
out = failure('--capability', 'browser_api_name', 'FF46')
messages = ['missing auth', 'basic auth failed']
assert any(message in out for message in messages)
Copy link
Contributor Author

@BeyondEvil BeyondEvil Aug 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this because the tests was passing for the wrong reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move these test fixes into a separate commit or pull request?

@@ -75,4 +75,4 @@ def test_invalid_host(failure, monkeypatch, tmpdir):
monkeypatch.setattr(os.path, 'expanduser', lambda p: str(tmpdir))
tmpdir.join('.testingbot').write('[credentials]\nkey=foo\nsecret=bar')
out = failure('--host', 'foo.bar.com')
assert "urlopen error" in out
assert "[Errno 8] nodename nor servname provided, or not known" in out
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message was different now due to Urllib3.

tox.ini Outdated
@@ -9,7 +9,7 @@ envlist = py{27,36,37,py,py3}, docs, flake8
[testenv]
passenv = DISPLAY PYTEST_ADDOPTS
deps = pytest-localserver
commands = pytest -v -r a {posargs}
commands = pytest -W error::DeprecationWarning -v -r a {posargs}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause any test to Fail if they cause any DeprecationWarnings to be invoked. @davehunt

@BeyondEvil BeyondEvil requested a review from davehunt August 14, 2018 15:46
Copy link
Contributor

@davehunt davehunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BeyondEvil! Just a minor nit to address before merging.

@@ -24,7 +24,7 @@ def testdir(request, httpserver_base_url):
if 'testdir' not in item.funcargnames:
return

testdir = request.getfuncargvalue('testdir')
testdir = request.getfixturevalue('testdir')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BeyondEvil. This was introduced in pytest 3.0.0, which we already depend on, so this is a very safe change.

@@ -123,7 +123,6 @@ def driver_kwargs(request, capabilities, chrome_options, driver_args,
host=pytestconfig.getoption('host'),
port=pytestconfig.getoption('port'),
request=request,
log_path=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this to service_log_path instead of removing it. Otherwise a driver_log of None would result in the default Firefox driver's log path of geckodriver.log to be used.

@BeyondEvil
Copy link
Contributor Author

I kept the driver_log fixture as to not introduce a breaking change for anyone that has overloaded it or uses directly.



def driver_kwargs(capabilities, driver_log, driver_path, **kwargs):
kwargs = {}
def driver_kwargs(capabilities, driver_path, service_log_path, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep the keyword argument as driver_log as this is already our abstraction from log_path and service_log_path.

driver_path=driver_path,
firefox_options=firefox_options,
firefox_profile=firefox_profile,
host=pytestconfig.getoption('host'),
port=pytestconfig.getoption('port'),
service_log_path=driver_log,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here is that driver_log gets used within our driver_kwargs methods to update service_log_path, which should default to None.

Copy link
Contributor

@davehunt davehunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Would you mind splitting some things into separate commits though? Otherwise we'll have a bunch of good but unrelated changes in a single commit.

@@ -24,7 +24,7 @@ def testdir(request, httpserver_base_url):
if 'testdir' not in item.funcargnames:
return

testdir = request.getfuncargvalue('testdir')
testdir = request.getfixturevalue('testdir')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to be a pain and ask you to split this (and a few other things) out into a separate commit or pull request. This shouldn't break anything for anyone, but if it does it makes it easier to identify if it's not combined with an unrelated change.

failure('--capability', 'browser_api_name', 'FF46')
out = failure('--capability', 'browser_api_name', 'FF46')
messages = ['missing auth', 'basic auth failed']
assert any(message in out for message in messages)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move these test fixes into a separate commit or pull request?

@@ -9,7 +9,7 @@

@pytest.mark.safari
def test_launch(testdir, httpserver):
httpserver.serve_content(content='<h1>Success!</h1>')
httpserver.serve_content(content='<body><h1>Success!</h1></body>')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this a separate commit or pull?

tox.ini Outdated
@@ -8,6 +8,7 @@ envlist = py{27,36,37,py,py3}, docs, flake8

[testenv]
passenv = DISPLAY PYTEST_ADDOPTS
setenv = MOZ_HEADLESS=1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this a separate commit or pull?

@BeyondEvil BeyondEvil merged commit 5f1c9d3 into pytest-dev:master Aug 17, 2018
@BeyondEvil BeyondEvil deleted the remove_log_path branch August 17, 2018 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants