From cc04bc5ca08e4761b41c5cf220889c4233f157a0 Mon Sep 17 00:00:00 2001
From: FFY00 <filipe.lains@gmail.com>
Date: Fri, 24 May 2019 19:08:41 +0100
Subject: [PATCH] tests: fix tests for pytest 4.0

---
 tests/plugins/mock_libudev.py | 6 ++++--
 tests/plugins/privileged.py   | 5 +++--
 tests/plugins/travis.py       | 5 +++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tests/plugins/mock_libudev.py b/tests/plugins/mock_libudev.py
index aefeb31..0bde07b 100644
--- a/tests/plugins/mock_libudev.py
+++ b/tests/plugins/mock_libudev.py
@@ -32,6 +32,7 @@
 from contextlib import contextmanager
 from collections import namedtuple
 
+import pytest
 import mock
 
 Node = namedtuple('Node', 'name value next')
@@ -93,5 +94,6 @@ def libudev_list(libudev, function, items):
 EXPOSED_FUNCTIONS = [libudev_list]
 
 
-def pytest_namespace():
-    return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
+def pytest_configure():
+    for f in EXPOSED_FUNCTIONS:
+        setattr(pytest, f.__name__, f)
diff --git a/tests/plugins/privileged.py b/tests/plugins/privileged.py
index 92328b9..c636980 100644
--- a/tests/plugins/privileged.py
+++ b/tests/plugins/privileged.py
@@ -71,5 +71,6 @@ def unload_dummy():
 EXPOSED_FUNCTIONS = [load_dummy, unload_dummy]
 
 
-def pytest_namespace():
-    return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
+def pytest_configure():
+    for f in EXPOSED_FUNCTIONS:
+        setattr(pytest, f.__name__, f)
diff --git a/tests/plugins/travis.py b/tests/plugins/travis.py
index 46466c2..15a780e 100644
--- a/tests/plugins/travis.py
+++ b/tests/plugins/travis.py
@@ -38,8 +38,9 @@ def is_on_travis_ci():
 EXPOSED_FUNCTIONS = [is_on_travis_ci]
 
 
-def pytest_namespace():
-    return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
+def pytest_configure():
+    for f in EXPOSED_FUNCTIONS:
+        setattr(pytest, f.__name__, f)
 
 
 def pytest_runtest_setup(item):
-- 
2.21.0

