Skip to content

Commit

Permalink
Merge pull request #528 from nicoddemus/fix-warnings
Browse files Browse the repository at this point in the history
Fix some of the warnings displayed by pytest 3.1.0
  • Loading branch information
obestwalter authored Jun 2, 2017
2 parents f2bcc1d + f34a591 commit 029801f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
31 changes: 18 additions & 13 deletions tests/test_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_quickstart_main_choose_individual_pythons_and_pytest(
deps =
pytest
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps(
Expand Down Expand Up @@ -105,7 +105,7 @@ def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps(
deps =
nose
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps(
Expand Down Expand Up @@ -147,7 +147,7 @@ def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps(
deps =
twisted
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps(
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps(
deps =
pytest
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_py27_and_pytest_adds_deps(
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_quickstart_main_choose_py27_and_pytest_adds_deps(
deps =
pytest
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps(
Expand Down Expand Up @@ -254,7 +254,7 @@ def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps(
deps =
pytest
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps(
Expand Down Expand Up @@ -287,7 +287,7 @@ def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps(
deps =
pytest
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_choose_individual_pythons_and_defaults(
Expand Down Expand Up @@ -329,7 +329,7 @@ def test_quickstart_main_choose_individual_pythons_and_defaults(
deps =
""".lstrip()
result = open('tox.ini').read()
result = read_tox()
assert(result == expected_tox_ini)

def test_quickstart_main_existing_tox_ini(self, monkeypatch):
Expand Down Expand Up @@ -376,7 +376,7 @@ def test_quickstart_main_existing_tox_ini(self, monkeypatch):
deps =
""".lstrip()
result = open('tox-generated.ini').read()
result = read_tox('tox-generated.ini')
assert(result == expected_tox_ini)


Expand Down Expand Up @@ -408,7 +408,7 @@ def test_pytest(self):
""".lstrip()
d = tox._quickstart.process_input(d)
tox._quickstart.generate(d)
result = open('tox.ini').read()
result = read_tox()
# print(result)
assert(result == expected_tox_ini)

Expand All @@ -435,7 +435,7 @@ def test_setup_py_test(self):
""".lstrip()
d = tox._quickstart.process_input(d)
tox._quickstart.generate(d)
result = open('tox.ini').read()
result = read_tox()
# print(result)
assert(result == expected_tox_ini)

Expand All @@ -461,7 +461,7 @@ def test_trial(self):
""".lstrip()
d = tox._quickstart.process_input(d)
tox._quickstart.generate(d)
result = open('tox.ini').read()
result = read_tox()
# print(result)
assert(result == expected_tox_ini)

Expand Down Expand Up @@ -492,6 +492,11 @@ def test_nosetests(self):
""".lstrip()
d = tox._quickstart.process_input(d)
tox._quickstart.generate(d)
result = open('tox.ini').read()
result = read_tox()
# print(result)
assert(result == expected_tox_ini)


def read_tox(fname='tox.ini'):
with open(fname) as f:
return f.read()
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ commands=echo {posargs}
[testenv]
commands= py.test --timeout=180 {posargs:tests}

deps=pytest>=2.3.5
deps=pytest>=3.0.0
pytest-timeout

[testenv:py26-bare]
Expand Down
8 changes: 4 additions & 4 deletions tox/_pytestplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def mocksession(request):
class MockSession(Session):
def __init__(self):
self._clearmocks()
self.config = request.getfuncargvalue("newconfig")([], "")
self.config = request.getfixturevalue("newconfig")([], "")
self.resultlog = ResultLog()
self._actions = []

Expand All @@ -168,8 +168,8 @@ def popen(self, args, cwd, shell=None,

@pytest.fixture
def newmocksession(request):
mocksession = request.getfuncargvalue("mocksession")
newconfig = request.getfuncargvalue("newconfig")
mocksession = request.getfixturevalue("mocksession")
newconfig = request.getfixturevalue("newconfig")

def newmocksession(args, source, plugins=()):
mocksession.config = newconfig(args, source, plugins=plugins)
Expand All @@ -179,7 +179,7 @@ def newmocksession(args, source, plugins=()):

class Cmd:
def __init__(self, request):
self.tmpdir = request.getfuncargvalue("tmpdir")
self.tmpdir = request.getfixturevalue("tmpdir")
self.request = request
current = py.path.local()
self.request.addfinalizer(current.chdir)
Expand Down

0 comments on commit 029801f

Please sign in to comment.