From 649082bd253deafa7d14c08aed4d97f93eb2aad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C5=A0=C4=8Dotka?= Date: Wed, 26 May 2021 09:32:13 +0200 Subject: [PATCH] adjust tests and skip data files --- tests/{ => unit/data}/config/.fmf/config | 0 tests/{ => unit/data}/config/.fmf/version | 0 .../{ => unit/data}/config/test_plugin_config.py | 0 tests/{ => unit/data}/tests_plugin/.fmf/version | 0 tests/{ => unit/data}/tests_plugin/main.fmf | 0 tests/{ => unit/data}/tests_plugin/runtest.sh | 0 tests/{ => unit/data}/tests_plugin/test_basic.py | 0 .../{ => unit/data}/tests_plugin/test_rewrite.fmf | 0 .../{ => unit/data}/tests_plugin/test_rewrite.py | 0 tests/unit/pytest.ini | 1 + tests/unit/test_plugin.py | 15 +++++++-------- 11 files changed, 8 insertions(+), 8 deletions(-) rename tests/{ => unit/data}/config/.fmf/config (100%) rename tests/{ => unit/data}/config/.fmf/version (100%) rename tests/{ => unit/data}/config/test_plugin_config.py (100%) rename tests/{ => unit/data}/tests_plugin/.fmf/version (100%) rename tests/{ => unit/data}/tests_plugin/main.fmf (100%) rename tests/{ => unit/data}/tests_plugin/runtest.sh (100%) rename tests/{ => unit/data}/tests_plugin/test_basic.py (100%) rename tests/{ => unit/data}/tests_plugin/test_rewrite.fmf (100%) rename tests/{ => unit/data}/tests_plugin/test_rewrite.py (100%) 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..56dfc956 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 +addopts = --ignore-glob="*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)