From: Nir Soffer <nsoffer(a)redhat.com>
Move the fixtures to conftest module. pytest discover these fixture and
make them available for all tests modules.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
tests/conftest.py | 21 +++++++++++++++++++++
tests/daemon_test.py | 14 --------------
2 files changed, 21 insertions(+), 14 deletions(-)
create mode 100644 tests/conftest.py
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..8055c88
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,21 @@
+"""
+Fixtures for sanlock testing.
+"""
+
+import pytest
+
+from . import util
+
+
+(a)pytest.fixture
+def sanlock_daemon():
+ """
+ Run sanlock daemon during a test.
+ """
+ p = util.start_daemon()
+ try:
+ util.wait_for_daemon(0.5)
+ yield
+ finally:
+ p.terminate()
+ p.wait()
diff --git a/tests/daemon_test.py b/tests/daemon_test.py
index d84b838..1e94563 100644
--- a/tests/daemon_test.py
+++ b/tests/daemon_test.py
@@ -12,20 +12,6 @@ import pytest
from . import util
-(a)pytest.fixture
-def sanlock_daemon():
- """
- Run sanlock daemon during a test.
- """
- p = util.start_daemon()
- try:
- util.wait_for_daemon(0.5)
- yield
- finally:
- p.terminate()
- p.wait()
-
-
def test_single_instance(sanlock_daemon):
# Starting another instance while the daemon must fail.
p = util.start_daemon()
--
2.9.5