backups: tests: Fix issue with usage of fixture 'needs_root'

Fixtures cannot be currently included into other fixtures by using
@pytest.mark.fixtures('fixture_name')
They have to be included as parameters instead.
See bug: https://github.com/pytest-dev/pytest/issues/3664

Also increase the scope of needs_root to the highest, i.e. session, so that it
can be used by any kind of fixture.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
Joseph Nuthalapati committed 2019-07-03 12:42:20 +05:30
1 parent f4f9e2c465
commit f85e7829b9
2 files changed
+59 -33

No files matched your search

+1 -1
View File
@@ -64,7 +64,7 @@ def fixture_develop_mode(load_cfg):
load_cfg.develop = False
@pytest.fixture(name='needs_root')
@pytest.fixture(name='needs_root', scope='session')
def fixture_needs_root():
"""Skip test if not running in root mode."""
if os.geteuid() != 0: