Skip to content

Commit

Permalink
adjust tests and skip data files
Browse files Browse the repository at this point in the history
  • Loading branch information
jscotka committed May 26, 2021
1 parent 244c828 commit 3497318
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions tests/unit/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[pytest]
markers =
web: tests which need to access the web
norecursedirs = *unit/data*
15 changes: 7 additions & 8 deletions tests/unit/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 3497318

Please sign in to comment.