1 From cc04bc5ca08e4761b41c5cf220889c4233f157a0 Mon Sep 17 00:00:00 2001
2 From: FFY00 <filipe.lains@gmail.com>
3 Date: Fri, 24 May 2019 19:08:41 +0100
4 Subject: [PATCH] tests: fix tests for pytest 4.0
7 tests/plugins/mock_libudev.py | 6 ++++--
8 tests/plugins/privileged.py | 5 +++--
9 tests/plugins/travis.py | 5 +++--
10 3 files changed, 10 insertions(+), 6 deletions(-)
12 diff --git a/tests/plugins/mock_libudev.py b/tests/plugins/mock_libudev.py
13 index aefeb31..0bde07b 100644
14 --- a/tests/plugins/mock_libudev.py
15 +++ b/tests/plugins/mock_libudev.py
17 from contextlib import contextmanager
18 from collections import namedtuple
23 Node = namedtuple('Node', 'name value next')
24 @@ -93,5 +94,6 @@ def libudev_list(libudev, function, items):
25 EXPOSED_FUNCTIONS = [libudev_list]
28 -def pytest_namespace():
29 - return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
30 +def pytest_configure():
31 + for f in EXPOSED_FUNCTIONS:
32 + setattr(pytest, f.__name__, f)
33 diff --git a/tests/plugins/privileged.py b/tests/plugins/privileged.py
34 index 92328b9..c636980 100644
35 --- a/tests/plugins/privileged.py
36 +++ b/tests/plugins/privileged.py
37 @@ -71,5 +71,6 @@ def unload_dummy():
38 EXPOSED_FUNCTIONS = [load_dummy, unload_dummy]
41 -def pytest_namespace():
42 - return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
43 +def pytest_configure():
44 + for f in EXPOSED_FUNCTIONS:
45 + setattr(pytest, f.__name__, f)
46 diff --git a/tests/plugins/travis.py b/tests/plugins/travis.py
47 index 46466c2..15a780e 100644
48 --- a/tests/plugins/travis.py
49 +++ b/tests/plugins/travis.py
50 @@ -38,8 +38,9 @@ def is_on_travis_ci():
51 EXPOSED_FUNCTIONS = [is_on_travis_ci]
54 -def pytest_namespace():
55 - return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
56 +def pytest_configure():
57 + for f in EXPOSED_FUNCTIONS:
58 + setattr(pytest, f.__name__, f)
61 def pytest_runtest_setup(item):