Skip to content

Commit

Permalink
Fix fixture dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed Mar 22, 2015
1 parent 6e7c9dc commit 0ee5c32
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion testinfra/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def check_output(cls, command, *args, **kwargs):
@classmethod
def as_fixture(cls):
@pytest.fixture(scope="session")
def f():
def f(testinfra_backend):
return cls
f.__doc__ = cls.__doc__
return f
2 changes: 1 addition & 1 deletion testinfra/modules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __repr__(self):
@classmethod
def as_fixture(cls):
@pytest.fixture(scope="session")
def f():
def f(testinfra_backend):
return Command()
f.__doc__ = cls.__doc__
return f
4 changes: 2 additions & 2 deletions testinfra/modules/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def __repr__(self):
@classmethod
def as_fixture(cls):
@pytest.fixture(scope="session")
def f():
if cls.run_test("which apt-get").rc == 0:
def f(Command):
if Command.run_test("which apt-get").rc == 0:
return DebianPackage
else:
raise NotImplementedError
Expand Down
2 changes: 1 addition & 1 deletion testinfra/modules/systeminfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def codename(self):
@classmethod
def as_fixture(cls):
@pytest.fixture(scope="session")
def f():
def f(testinfra_backend):
return SystemInfo()
f.__doc__ = cls.__doc__
return f
4 changes: 2 additions & 2 deletions testinfra/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
SystemInfo = modules.SystemInfo.as_fixture()


@pytest.fixture(autouse=True, scope="session")
def _testinfra_set_backend(pytestconfig, _testinfra_host):
@pytest.fixture(scope="session")
def testinfra_backend(pytestconfig, _testinfra_host):
if _testinfra_host is not None:
backend_type = pytestconfig.option.connection or "ssh"
testinfra.set_backend(backend_type, _testinfra_host)
Expand Down

0 comments on commit 0ee5c32

Please sign in to comment.