Skip to content

Commit 4e085ed

Browse files
committed
Fix failing tests
1 parent 9e4ef72 commit 4e085ed

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

pytest_selenium/pytest_selenium.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ def _gather_logs(item, report, driver, summary, extra):
334334

335335
def _gather_driver_log(item, summary, extra):
336336
pytest_html = item.config.pluginmanager.getplugin("html")
337-
if hasattr(item.config, "_driver_log") and os.path.exists(item.config._driver_log):
337+
if (
338+
hasattr(item.config, "_driver_log")
339+
and item.config._driver_log is not None
340+
and os.path.exists(item.config._driver_log)
341+
):
338342
if pytest_html is not None:
339343
with io.open(item.config._driver_log, "r", encoding="utf8") as f:
340344
extra.append(pytest_html.extras.text(f.read(), "Driver Log"))
@@ -344,7 +348,7 @@ def _gather_driver_log(item, summary, extra):
344348
def format_log(log):
345349
timestamp_format = "%Y-%m-%d %H:%M:%S.%f"
346350
entries = [
347-
u"{0} {1[level]} - {1[message]}".format(
351+
"{0} {1[level]} - {1[message]}".format(
348352
datetime.utcfromtimestamp(entry["timestamp"] / 1000.0).strftime(
349353
timestamp_format
350354
),

testing/test_crossbrowsertesting.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,3 @@ def test_missing_access_key_file(failure, monkeypatch, tmpdir):
5656
monkeypatch.setattr(os.path, "expanduser", lambda p: str(tmpdir))
5757
tmpdir.join(".crossbrowsertesting").write("[credentials]\nusername=foo")
5858
assert "CrossBrowserTesting key must be set" in failure()
59-
60-
61-
@pytest.mark.parametrize(
62-
("username", "key"),
63-
[
64-
("CROSSBROWSERTESTING_USERNAME", "CROSSBROWSERTESTING_AUTH_KEY"),
65-
("CROSSBROWSERTESTING_USR", "CROSSBROWSERTESTING_PSW"),
66-
],
67-
)
68-
def test_invalid_credentials_env(failure, monkeypatch, tmpdir, username, key):
69-
monkeypatch.setattr(os.path, "expanduser", lambda p: str(tmpdir))
70-
monkeypatch.setenv(username, "foo")
71-
monkeypatch.setenv(key, "bar")
72-
out = failure("--capability", "browser_api_name", "FF46")
73-
messages = ["missing auth", "basic auth failed"]
74-
assert any(message in out for message in messages)
75-
76-
77-
def test_invalid_credentials_file(failure, monkeypatch, tmpdir):
78-
monkeypatch.setattr(os.path, "expanduser", lambda p: str(tmpdir))
79-
config = tmpdir.join(".crossbrowsertesting")
80-
config.write("[credentials]\nusername=foo\nkey=bar")
81-
out = failure("--capability", "browser_api_name", "FF46")
82-
messages = ["missing auth", "basic auth failed"]
83-
assert any(message in out for message in messages)

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ setenv =
1414
deps =
1515
pytest-localserver
1616
pytest-xdist
17-
commands = pytest -n auto -v -r a {posargs}
17+
commands = pytest -n auto -v -r a --color=yes --html={envlogdir}/report.html --self-contained-html {posargs}
1818

1919
[testenv:docs]
2020
basepython = python
@@ -43,3 +43,7 @@ markers =
4343
skip_selenium
4444
nondestructive
4545
phantomjs
46+
# TODO: Temporary hack until they fix
47+
# https://github.com/pytest-dev/pytest/issues/6936
48+
filterwarnings =
49+
ignore:.*TerminalReporter.writer attribute is deprecated.*:pytest.PytestDeprecationWarning

0 commit comments

Comments
 (0)