diff --git a/tests/config/.fmf/config b/tests/unit/data/config/.fmf/config similarity index 100% rename from tests/config/.fmf/config rename to tests/unit/data/config/.fmf/config diff --git a/tests/config/.fmf/version b/tests/unit/data/config/.fmf/version similarity index 100% rename from tests/config/.fmf/version rename to tests/unit/data/config/.fmf/version diff --git a/tests/config/test_plugin_config.py b/tests/unit/data/config/test_plugin_config.py similarity index 100% rename from tests/config/test_plugin_config.py rename to tests/unit/data/config/test_plugin_config.py diff --git a/tests/tests_plugin/.fmf/version b/tests/unit/data/tests_plugin/.fmf/version similarity index 100% rename from tests/tests_plugin/.fmf/version rename to tests/unit/data/tests_plugin/.fmf/version diff --git a/tests/tests_plugin/main.fmf b/tests/unit/data/tests_plugin/main.fmf similarity index 100% rename from tests/tests_plugin/main.fmf rename to tests/unit/data/tests_plugin/main.fmf diff --git a/tests/tests_plugin/runtest.sh b/tests/unit/data/tests_plugin/runtest.sh similarity index 100% rename from tests/tests_plugin/runtest.sh rename to tests/unit/data/tests_plugin/runtest.sh diff --git a/tests/tests_plugin/test_basic.py b/tests/unit/data/tests_plugin/test_basic.py similarity index 100% rename from tests/tests_plugin/test_basic.py rename to tests/unit/data/tests_plugin/test_basic.py diff --git a/tests/tests_plugin/test_rewrite.fmf b/tests/unit/data/tests_plugin/test_rewrite.fmf similarity index 100% rename from tests/tests_plugin/test_rewrite.fmf rename to tests/unit/data/tests_plugin/test_rewrite.fmf diff --git a/tests/tests_plugin/test_rewrite.py b/tests/unit/data/tests_plugin/test_rewrite.py similarity index 100% rename from tests/tests_plugin/test_rewrite.py rename to tests/unit/data/tests_plugin/test_rewrite.py diff --git a/tests/unit/pytest.ini b/tests/unit/pytest.ini index cafe5e5d..c8be441b 100644 --- a/tests/unit/pytest.ini +++ b/tests/unit/pytest.ini @@ -1,3 +1,4 @@ [pytest] markers = web: tests which need to access the web +norecursedirs = *unit/data* diff --git a/tests/unit/test_plugin.py b/tests/unit/test_plugin.py index 5de2689f..51ae04f7 100644 --- a/tests/unit/test_plugin.py +++ b/tests/unit/test_plugin.py @@ -3,23 +3,23 @@ from __future__ import absolute_import, unicode_literals import os -import subprocess import tempfile import unittest +from pathlib import Path from shutil import copytree, rmtree from fmf.base import Tree from fmf.constants import PLUGIN_ENV from fmf.plugin_loader import enabled_plugins -PATH = os.path.dirname(os.path.realpath(__file__)) -EXAMPLES = os.path.join(PATH, "..", "tests_plugin") -PLUGIN_PATH = os.path.join(PATH, "..", "..", "fmf", "plugins") +PATH = Path(__file__).parent +EXAMPLES = PATH / "data" +PLUGIN_PATH = PATH.parent.parent / "fmf" / "plugins" class Base(unittest.TestCase): def setUp(self): - self.test_path = EXAMPLES + self.test_path = EXAMPLES / "tests_plugin" self.tempdir = tempfile.mktemp() copytree(self.test_path, self.tempdir) # ensure the cache is cleared, to ensure that plugis are not already @@ -96,8 +96,7 @@ class Bash(Base): def setUp(self): super().setUp() - os.environ[PLUGIN_ENV] = os.path.abspath( - os.path.join(PLUGIN_PATH, "bash.py")) + os.environ[PLUGIN_ENV] = str(PLUGIN_PATH / "bash.py") self.plugin_tree = Tree(self.tempdir) def test_read(self): @@ -125,7 +124,7 @@ def test_modify(self): class TestConf(unittest.TestCase): def setUp(self): - self.test_path = os.path.realpath(os.path.join(PATH, "..", "config")) + self.test_path = EXAMPLES / "config" enabled_plugins.cache_clear() self.plugin_tree = Tree(self.test_path)