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