Skip to content

Commit

Permalink
Fix tests for Python 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
davehunt committed May 3, 2017
1 parent 0fa4ce3 commit 5ad52c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion testing/test_chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def test_pass(selenium): pass
def test_args(testdir):
file_test = testdir.makepyfile("""
import pytest
@pytest.fixture
def driver_log():
return None
@pytest.fixture
def driver_args():
return ['--log-path=foo.log']
Expand All @@ -52,4 +56,4 @@ def driver_args():
def test_pass(selenium): pass
""")
testdir.quick_qa('--driver', 'Chrome', file_test, passed=1)
assert os.path.exists(testdir.tmpdir.join('foo.log'))
assert os.path.exists(str(testdir.tmpdir.join('foo.log')))
6 changes: 3 additions & 3 deletions testing/test_driver_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_fail(webtext):
with open(str(path)) as f:
html = f.read()
assert re.search(LOG_REGEX, html) is not None
assert os.path.exists(testdir.tmpdir.join('driver.log'))
assert os.path.exists(str(testdir.tmpdir.join('driver.log')))


def test_driver_log_fixture(testdir, httpserver):
Expand All @@ -41,7 +41,7 @@ def test_pass(webtext):
assert webtext == u'Success!'
""")
testdir.quick_qa(file_test, passed=1)
assert os.path.exists(testdir.tmpdir.join('foo.log'))
assert os.path.exists(str(testdir.tmpdir.join('foo.log')))


def test_no_driver_log(testdir, httpserver):
Expand All @@ -61,4 +61,4 @@ def test_fail(webtext):
with open(str(path)) as f:
html = f.read()
assert re.search(LOG_REGEX, html) is None
assert not os.path.exists(testdir.tmpdir.join('driver.log'))
assert not os.path.exists(str(testdir.tmpdir.join('driver.log')))
2 changes: 1 addition & 1 deletion testing/test_phantomjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def driver_args():
def test_pass(selenium): pass
""")
testdir.quick_qa('--driver', 'PhantomJS', file_test, passed=1)
assert os.path.exists(testdir.tmpdir.join('foo.log'))
assert os.path.exists(str(testdir.tmpdir.join('foo.log')))

0 comments on commit 5ad52c5

Please sign in to comment.