|
|
5c7b2d |
From 8dbb92d692db9cbfbca0c82a1ed10a0492208534 Mon Sep 17 00:00:00 2001
|
|
|
5c7b2d |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
5c7b2d |
Date: Wed, 4 Aug 2021 13:00:53 +0200
|
|
|
5c7b2d |
Subject: [PATCH 1/3] edd_test: Locate the edd_data based on the test file
|
|
|
5c7b2d |
location
|
|
|
5c7b2d |
|
|
|
5c7b2d |
We can't use the blivet.edd module location when running tests
|
|
|
5c7b2d |
against installed version of blivet.
|
|
|
5c7b2d |
---
|
|
|
5c7b2d |
tests/devicelibs_test/edd_test.py | 5 ++---
|
|
|
5c7b2d |
1 file changed, 2 insertions(+), 3 deletions(-)
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
index 21bbcffc4..0d0824e6b 100644
|
|
|
5c7b2d |
--- a/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
+++ b/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
@@ -5,7 +5,6 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
import unittest
|
|
|
5c7b2d |
import os
|
|
|
5c7b2d |
-import inspect
|
|
|
5c7b2d |
import logging
|
|
|
5c7b2d |
import copy
|
|
|
5c7b2d |
|
|
|
5c7b2d |
@@ -114,9 +113,9 @@ def root(self, name):
|
|
|
5c7b2d |
name = name[:-1]
|
|
|
5c7b2d |
if name.startswith("/"):
|
|
|
5c7b2d |
name = name[1:]
|
|
|
5c7b2d |
- dirname = os.path.dirname(inspect.getfile(edd))
|
|
|
5c7b2d |
+ dirname = os.path.abspath(os.path.dirname(__file__))
|
|
|
5c7b2d |
return os.path.join(dirname,
|
|
|
5c7b2d |
- "../../tests/devicelibs_test/edd_data/",
|
|
|
5c7b2d |
+ "edd_data/",
|
|
|
5c7b2d |
name)
|
|
|
5c7b2d |
|
|
|
5c7b2d |
def edd_debug(self, *args):
|
|
|
5c7b2d |
|
|
|
5c7b2d |
From 924bc805f692b0f050a8a8b8187769f36aea059f Mon Sep 17 00:00:00 2001
|
|
|
5c7b2d |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
5c7b2d |
Date: Wed, 4 Aug 2021 13:02:08 +0200
|
|
|
5c7b2d |
Subject: [PATCH 2/3] tests: Allow running tests without the tests directory in
|
|
|
5c7b2d |
PYTHONPATH
|
|
|
5c7b2d |
|
|
|
5c7b2d |
When running the tests against installed version of blivet, the
|
|
|
5c7b2d |
"tests" directory is not in PYTHONPATH so we need to import all
|
|
|
5c7b2d |
helper modules using relative path.
|
|
|
5c7b2d |
---
|
|
|
5c7b2d |
tests/action_test.py | 2 +-
|
|
|
5c7b2d |
tests/devicelibs_test/edd_test.py | 2 +-
|
|
|
5c7b2d |
tests/{ => devicelibs_test}/lib.py | 0
|
|
|
5c7b2d |
tests/formats_test/fs_test.py | 2 +-
|
|
|
5c7b2d |
tests/formats_test/fslabeling.py | 2 +-
|
|
|
5c7b2d |
tests/formats_test/fstesting.py | 2 +-
|
|
|
5c7b2d |
tests/formats_test/fsuuid.py | 2 +-
|
|
|
5c7b2d |
tests/formats_test/labeling_test.py | 2 +-
|
|
|
5c7b2d |
tests/{ => formats_test}/loopbackedtestcase.py | 0
|
|
|
5c7b2d |
tests/formats_test/luks_test.py | 2 +-
|
|
|
5c7b2d |
tests/formats_test/lvmpv_test.py | 2 +-
|
|
|
5c7b2d |
tests/partitioning_test.py | 2 +-
|
|
|
5c7b2d |
12 files changed, 10 insertions(+), 10 deletions(-)
|
|
|
5c7b2d |
rename tests/{ => devicelibs_test}/lib.py (100%)
|
|
|
5c7b2d |
rename tests/{ => formats_test}/loopbackedtestcase.py (100%)
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/action_test.py b/tests/action_test.py
|
|
|
5c7b2d |
index f60cf5d7e..8509ce35a 100644
|
|
|
5c7b2d |
--- a/tests/action_test.py
|
|
|
5c7b2d |
+++ b/tests/action_test.py
|
|
|
5c7b2d |
@@ -5,7 +5,7 @@
|
|
|
5c7b2d |
except ImportError:
|
|
|
5c7b2d |
from mock import Mock
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests.storagetestcase import StorageTestCase
|
|
|
5c7b2d |
+from storagetestcase import StorageTestCase
|
|
|
5c7b2d |
import blivet
|
|
|
5c7b2d |
from blivet.formats import get_format
|
|
|
5c7b2d |
from blivet.size import Size
|
|
|
5c7b2d |
diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
index 0d0824e6b..0db1fd16e 100644
|
|
|
5c7b2d |
--- a/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
+++ b/tests/devicelibs_test/edd_test.py
|
|
|
5c7b2d |
@@ -10,7 +10,7 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
from blivet import arch
|
|
|
5c7b2d |
from blivet.devicelibs import edd
|
|
|
5c7b2d |
-from tests import lib
|
|
|
5c7b2d |
+from . import lib
|
|
|
5c7b2d |
|
|
|
5c7b2d |
|
|
|
5c7b2d |
class FakeDevice(object):
|
|
|
5c7b2d |
diff --git a/tests/lib.py b/tests/devicelibs_test/lib.py
|
|
|
5c7b2d |
similarity index 100%
|
|
|
5c7b2d |
rename from tests/lib.py
|
|
|
5c7b2d |
rename to tests/devicelibs_test/lib.py
|
|
|
5c7b2d |
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
|
|
|
5c7b2d |
index ab3499a76..bd6433707 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/fs_test.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/fs_test.py
|
|
|
5c7b2d |
@@ -10,7 +10,7 @@
|
|
|
5c7b2d |
from blivet.formats import get_format
|
|
|
5c7b2d |
from blivet.devices import PartitionDevice, DiskDevice
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
|
|
|
5c7b2d |
from . import fstesting
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/formats_test/fslabeling.py b/tests/formats_test/fslabeling.py
|
|
|
5c7b2d |
index fbb28eee7..0e0dc2612 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/fslabeling.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/fslabeling.py
|
|
|
5c7b2d |
@@ -2,7 +2,7 @@
|
|
|
5c7b2d |
import abc
|
|
|
5c7b2d |
import six
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
from blivet.errors import FSError, FSReadLabelError
|
|
|
5c7b2d |
from blivet.size import Size
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
|
|
|
5c7b2d |
index 86b2a1168..e34584d88 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/fstesting.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/fstesting.py
|
|
|
5c7b2d |
@@ -5,7 +5,7 @@
|
|
|
5c7b2d |
import os
|
|
|
5c7b2d |
import tempfile
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
from blivet.errors import FSError, FSResizeError, DeviceFormatError
|
|
|
5c7b2d |
from blivet.size import Size, ROUND_DOWN
|
|
|
5c7b2d |
from blivet.formats import fs
|
|
|
5c7b2d |
diff --git a/tests/formats_test/fsuuid.py b/tests/formats_test/fsuuid.py
|
|
|
5c7b2d |
index c80039457..16aa19a66 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/fsuuid.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/fsuuid.py
|
|
|
5c7b2d |
@@ -3,7 +3,7 @@
|
|
|
5c7b2d |
import six
|
|
|
5c7b2d |
from unittest import skipIf
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
from blivet.errors import FSError, FSWriteUUIDError
|
|
|
5c7b2d |
from blivet.size import Size
|
|
|
5c7b2d |
from blivet.util import capture_output
|
|
|
5c7b2d |
diff --git a/tests/formats_test/labeling_test.py b/tests/formats_test/labeling_test.py
|
|
|
5c7b2d |
index e26cb7df1..d24e66191 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/labeling_test.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/labeling_test.py
|
|
|
5c7b2d |
@@ -1,10 +1,10 @@
|
|
|
5c7b2d |
import unittest
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
from blivet.formats import device_formats
|
|
|
5c7b2d |
import blivet.formats.fs as fs
|
|
|
5c7b2d |
import blivet.formats.swap as swap
|
|
|
5c7b2d |
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
from . import fslabeling
|
|
|
5c7b2d |
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/loopbackedtestcase.py b/tests/formats_test/loopbackedtestcase.py
|
|
|
5c7b2d |
similarity index 100%
|
|
|
5c7b2d |
rename from tests/loopbackedtestcase.py
|
|
|
5c7b2d |
rename to tests/formats_test/loopbackedtestcase.py
|
|
|
5c7b2d |
diff --git a/tests/formats_test/luks_test.py b/tests/formats_test/luks_test.py
|
|
|
5c7b2d |
index 1edbdcb28..5f25f0988 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/luks_test.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/luks_test.py
|
|
|
5c7b2d |
@@ -9,7 +9,7 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
from blivet.size import Size
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
|
|
|
5c7b2d |
|
|
|
5c7b2d |
class LUKSTestCase(loopbackedtestcase.LoopBackedTestCase):
|
|
|
5c7b2d |
diff --git a/tests/formats_test/lvmpv_test.py b/tests/formats_test/lvmpv_test.py
|
|
|
5c7b2d |
index cbd2c4195..cdc33ec4d 100644
|
|
|
5c7b2d |
--- a/tests/formats_test/lvmpv_test.py
|
|
|
5c7b2d |
+++ b/tests/formats_test/lvmpv_test.py
|
|
|
5c7b2d |
@@ -2,7 +2,7 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
from blivet.size import Size
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests import loopbackedtestcase
|
|
|
5c7b2d |
+from . import loopbackedtestcase
|
|
|
5c7b2d |
|
|
|
5c7b2d |
|
|
|
5c7b2d |
class LVMPVTestCase(loopbackedtestcase.LoopBackedTestCase):
|
|
|
5c7b2d |
diff --git a/tests/partitioning_test.py b/tests/partitioning_test.py
|
|
|
5c7b2d |
index 9b27f0c0d..e7b7aa375 100644
|
|
|
5c7b2d |
--- a/tests/partitioning_test.py
|
|
|
5c7b2d |
+++ b/tests/partitioning_test.py
|
|
|
5c7b2d |
@@ -31,7 +31,7 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
from blivet.errors import PartitioningError
|
|
|
5c7b2d |
|
|
|
5c7b2d |
-from tests.imagebackedtestcase import ImageBackedTestCase
|
|
|
5c7b2d |
+from imagebackedtestcase import ImageBackedTestCase
|
|
|
5c7b2d |
from blivet.blivet import Blivet
|
|
|
5c7b2d |
from blivet.util import sparsetmpfile
|
|
|
5c7b2d |
from blivet.formats import get_format
|
|
|
5c7b2d |
|
|
|
5c7b2d |
From 99385bd67ac944c43bc77f4b5465c672203e2679 Mon Sep 17 00:00:00 2001
|
|
|
5c7b2d |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
5c7b2d |
Date: Fri, 6 Aug 2021 14:51:01 +0200
|
|
|
5c7b2d |
Subject: [PATCH 3/3] tests: Print version and blivet location when running
|
|
|
5c7b2d |
tests
|
|
|
5c7b2d |
|
|
|
5c7b2d |
---
|
|
|
5c7b2d |
tests/run_tests.py | 5 +++++
|
|
|
5c7b2d |
1 file changed, 5 insertions(+)
|
|
|
5c7b2d |
|
|
|
5c7b2d |
diff --git a/tests/run_tests.py b/tests/run_tests.py
|
|
|
5c7b2d |
index 32e3f2d3a..8ad8b61ad 100644
|
|
|
5c7b2d |
--- a/tests/run_tests.py
|
|
|
5c7b2d |
+++ b/tests/run_tests.py
|
|
|
5c7b2d |
@@ -32,6 +32,11 @@
|
|
|
5c7b2d |
|
|
|
5c7b2d |
testdir = os.path.abspath(os.path.dirname(__file__))
|
|
|
5c7b2d |
|
|
|
5c7b2d |
+ import blivet
|
|
|
5c7b2d |
+ print("Running tests with Blivet %s from %s" % (blivet.__version__,
|
|
|
5c7b2d |
+ os.path.abspath(os.path.dirname(blivet.__file__))),
|
|
|
5c7b2d |
+ file=sys.stderr)
|
|
|
5c7b2d |
+
|
|
|
5c7b2d |
if args.testname:
|
|
|
5c7b2d |
for n in args.testname:
|
|
|
5c7b2d |
suite.addTests(unittest.TestLoader().loadTestsFromName(n))
|