diff --git a/examples/jobs/nrunner.py b/examples/jobs/nrunner.py index 8b3382bbd8..d642387066 100755 --- a/examples/jobs/nrunner.py +++ b/examples/jobs/nrunner.py @@ -13,7 +13,7 @@ 'nrunner.status_server_listen': status_server, 'nrunner.status_server_uri': status_server, 'run.references': [ - 'selftests/unit/test_resolver.py', + 'selftests/unit/plugin/test_resolver.py', 'selftests/functional/test_argument_parsing.py', '/bin/true', ], diff --git a/selftests/check.py b/selftests/check.py index e270e56a27..084809cc0c 100755 --- a/selftests/check.py +++ b/selftests/check.py @@ -498,9 +498,9 @@ def create_suites(args): # Run all static checks, unit and functional tests # ======================================================================== config_check = { - 'run.references': (glob.glob('selftests/jobs/*') + - glob.glob('selftests/unit/*.py') + - glob.glob('selftests/functional/*.py')), + 'run.references': ['selftests/jobs/', + 'selftests/unit/', + 'selftests/functional/'], 'run.test_runner': 'nrunner', 'run.ignore_missing_references': True } diff --git a/selftests/functional/test_plugin_assets.py b/selftests/functional/plugin/test_assets.py similarity index 99% rename from selftests/functional/test_plugin_assets.py rename to selftests/functional/plugin/test_assets.py index 2a998b6286..74eacb7c6b 100644 --- a/selftests/functional/test_plugin_assets.py +++ b/selftests/functional/plugin/test_assets.py @@ -11,8 +11,8 @@ from avocado.core import exit_codes from avocado.utils import process -from .. import (AVOCADO, TestCaseTmpDir, get_temporary_config, - skipUnlessPathExists) +from ... import (AVOCADO, TestCaseTmpDir, get_temporary_config, + skipUnlessPathExists) TEST_TEMPLATE = r""" from avocado import Test diff --git a/selftests/functional/test_plugin_diff.py b/selftests/functional/plugin/test_diff.py similarity index 98% rename from selftests/functional/test_plugin_diff.py rename to selftests/functional/plugin/test_diff.py index a5da1bfcf9..0f99424cca 100644 --- a/selftests/functional/test_plugin_diff.py +++ b/selftests/functional/plugin/test_diff.py @@ -6,7 +6,7 @@ from avocado.core import exit_codes from avocado.utils import process, script -from .. import AVOCADO, BASEDIR, TestCaseTmpDir +from ... import AVOCADO, BASEDIR, TestCaseTmpDir class DiffTests(TestCaseTmpDir): diff --git a/selftests/functional/test_plugin_jobscripts.py b/selftests/functional/plugin/test_jobscripts.py similarity index 99% rename from selftests/functional/test_plugin_jobscripts.py rename to selftests/functional/plugin/test_jobscripts.py index d0b57aef18..950ebad83d 100644 --- a/selftests/functional/test_plugin_jobscripts.py +++ b/selftests/functional/plugin/test_jobscripts.py @@ -4,7 +4,7 @@ from avocado.core import exit_codes from avocado.utils import process, script -from .. import AVOCADO, TestCaseTmpDir +from ... import AVOCADO, TestCaseTmpDir SCRIPT_PRE_TOUCH = """#!/bin/sh -e touch %s""" diff --git a/selftests/functional/test_plugin_vmimage.py b/selftests/functional/plugin/test_vmimage.py similarity index 98% rename from selftests/functional/test_plugin_vmimage.py rename to selftests/functional/plugin/test_vmimage.py index 58445884b0..12d719c2f9 100644 --- a/selftests/functional/test_plugin_vmimage.py +++ b/selftests/functional/plugin/test_vmimage.py @@ -5,7 +5,7 @@ from avocado.core import exit_codes from avocado.utils import path, process -from .. import AVOCADO, get_temporary_config +from ... import AVOCADO, get_temporary_config def missing_binary(binary): diff --git a/selftests/unit/test_plugin_assets.py b/selftests/unit/plugin/test_assets.py similarity index 100% rename from selftests/unit/test_plugin_assets.py rename to selftests/unit/plugin/test_assets.py diff --git a/selftests/unit/test_jsonresult.py b/selftests/unit/plugin/test_jsonresult.py similarity index 98% rename from selftests/unit/test_jsonresult.py rename to selftests/unit/plugin/test_jsonresult.py index 5bc1fe63c1..6b6a0e8948 100644 --- a/selftests/unit/test_jsonresult.py +++ b/selftests/unit/plugin/test_jsonresult.py @@ -7,7 +7,7 @@ from avocado.core.result import Result from avocado.plugins import jsonresult -from .. import TestCaseTmpDir, setup_avocado_loggers +from ... import TestCaseTmpDir, setup_avocado_loggers setup_avocado_loggers() diff --git a/selftests/unit/test_legacy_replay.py b/selftests/unit/plugin/test_legacy_replay.py similarity index 98% rename from selftests/unit/test_legacy_replay.py rename to selftests/unit/plugin/test_legacy_replay.py index 40622d9a7a..2cbad66229 100644 --- a/selftests/unit/test_legacy_replay.py +++ b/selftests/unit/plugin/test_legacy_replay.py @@ -5,7 +5,7 @@ from avocado.core import test from avocado.plugins.legacy import replay as replay_legacy -from .. import setup_avocado_loggers, temp_dir_prefix +from ... import setup_avocado_loggers, temp_dir_prefix setup_avocado_loggers() diff --git a/selftests/unit/test_resolver.py b/selftests/unit/plugin/test_resolver.py similarity index 99% rename from selftests/unit/test_resolver.py rename to selftests/unit/plugin/test_resolver.py index 6915d2775b..a880f90f42 100644 --- a/selftests/unit/test_resolver.py +++ b/selftests/unit/plugin/test_resolver.py @@ -6,7 +6,7 @@ ExecTestResolver) from avocado.utils import script -from .. import BASEDIR +from ... import BASEDIR class ReferenceResolution(unittest.TestCase): diff --git a/selftests/unit/test_spawner.py b/selftests/unit/plugin/test_spawner.py similarity index 100% rename from selftests/unit/test_spawner.py rename to selftests/unit/plugin/test_spawner.py diff --git a/selftests/unit/test_plugin_vmimage.py b/selftests/unit/plugin/test_vmimage.py similarity index 97% rename from selftests/unit/test_plugin_vmimage.py rename to selftests/unit/plugin/test_vmimage.py index 005cc2e0ad..d4c950aca4 100644 --- a/selftests/unit/test_plugin_vmimage.py +++ b/selftests/unit/plugin/test_vmimage.py @@ -8,9 +8,9 @@ from avocado.plugins import vmimage as vmimage_plugin from avocado.utils import vmimage as vmimage_util -from .. import skipOnLevelsInferiorThan, temp_dir_prefix -from ..functional.test_plugin_vmimage import (create_metadata_file, - missing_binary) +from ... import skipOnLevelsInferiorThan, temp_dir_prefix +from ...functional.plugin.test_vmimage import (create_metadata_file, + missing_binary) #: extracted from https://dl.fedoraproject.org/pub/fedora/linux/releases/ FEDORA_PAGE = """ diff --git a/selftests/unit/test_xunit.py b/selftests/unit/plugin/test_xunit.py similarity index 95% rename from selftests/unit/test_xunit.py rename to selftests/unit/plugin/test_xunit.py index d4e9584d9c..b10cba212a 100644 --- a/selftests/unit/test_xunit.py +++ b/selftests/unit/plugin/test_xunit.py @@ -8,7 +8,7 @@ from avocado.core.result import Result from avocado.plugins import xunit -from .. import setup_avocado_loggers, temp_dir_prefix +from ... import setup_avocado_loggers, temp_dir_prefix try: import xmlschema @@ -93,9 +93,10 @@ def test_add_success(self): self.assertEqual(len(els), 1) self.assertEqual(els[0].attributes['time'].value, '678.237') - junit_xsd = os.path.abspath(os.path.join(os.path.dirname(__file__), - os.path.pardir, ".data", - 'jenkins-junit.xsd')) + junit_xsd = os.path.abspath(os.path.join( + os.path.dirname(os.path.dirname(__file__)), + os.path.pardir, ".data", + 'jenkins-junit.xsd')) xml_schema = xmlschema.XMLSchema(junit_xsd) self.assertTrue(xml_schema.is_valid(xunit_output)) diff --git a/selftests/unit/test_utils_astring.py b/selftests/unit/utils/test_astring.py similarity index 100% rename from selftests/unit/test_utils_astring.py rename to selftests/unit/utils/test_astring.py diff --git a/selftests/unit/test_utils_cloudinit.py b/selftests/unit/utils/test_cloudinit.py similarity index 98% rename from selftests/unit/test_utils_cloudinit.py rename to selftests/unit/utils/test_cloudinit.py index e08b17256b..0043dc1c18 100644 --- a/selftests/unit/test_utils_cloudinit.py +++ b/selftests/unit/utils/test_cloudinit.py @@ -6,7 +6,7 @@ from avocado.utils import cloudinit, data_factory, iso9660 -from .. import setup_avocado_loggers, temp_dir_prefix +from ... import setup_avocado_loggers, temp_dir_prefix setup_avocado_loggers() diff --git a/selftests/unit/test_utils_cpu.py b/selftests/unit/utils/test_cpu.py similarity index 100% rename from selftests/unit/test_utils_cpu.py rename to selftests/unit/utils/test_cpu.py diff --git a/selftests/unit/test_utils_cpu.py.data/armv7 b/selftests/unit/utils/test_cpu.py.data/armv7 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/armv7 rename to selftests/unit/utils/test_cpu.py.data/armv7 diff --git a/selftests/unit/test_utils_cpu.py.data/armv8 b/selftests/unit/utils/test_cpu.py.data/armv8 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/armv8 rename to selftests/unit/utils/test_cpu.py.data/armv8 diff --git a/selftests/unit/test_utils_cpu.py.data/i386 b/selftests/unit/utils/test_cpu.py.data/i386 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/i386 rename to selftests/unit/utils/test_cpu.py.data/i386 diff --git a/selftests/unit/test_utils_cpu.py.data/power8 b/selftests/unit/utils/test_cpu.py.data/power8 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/power8 rename to selftests/unit/utils/test_cpu.py.data/power8 diff --git a/selftests/unit/test_utils_cpu.py.data/power9 b/selftests/unit/utils/test_cpu.py.data/power9 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/power9 rename to selftests/unit/utils/test_cpu.py.data/power9 diff --git a/selftests/unit/test_utils_cpu.py.data/risc_v b/selftests/unit/utils/test_cpu.py.data/risc_v similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/risc_v rename to selftests/unit/utils/test_cpu.py.data/risc_v diff --git a/selftests/unit/test_utils_cpu.py.data/s390x b/selftests/unit/utils/test_cpu.py.data/s390x similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/s390x rename to selftests/unit/utils/test_cpu.py.data/s390x diff --git a/selftests/unit/test_utils_cpu.py.data/s390x_2 b/selftests/unit/utils/test_cpu.py.data/s390x_2 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/s390x_2 rename to selftests/unit/utils/test_cpu.py.data/s390x_2 diff --git a/selftests/unit/test_utils_cpu.py.data/s390x_3 b/selftests/unit/utils/test_cpu.py.data/s390x_3 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/s390x_3 rename to selftests/unit/utils/test_cpu.py.data/s390x_3 diff --git a/selftests/unit/test_utils_cpu.py.data/x86_64 b/selftests/unit/utils/test_cpu.py.data/x86_64 similarity index 100% rename from selftests/unit/test_utils_cpu.py.data/x86_64 rename to selftests/unit/utils/test_cpu.py.data/x86_64 diff --git a/selftests/unit/test_utils_datadrainer.py b/selftests/unit/utils/test_datadrainer.py similarity index 100% rename from selftests/unit/test_utils_datadrainer.py rename to selftests/unit/utils/test_datadrainer.py diff --git a/selftests/unit/test_utils_diff_validator.py b/selftests/unit/utils/test_diff_validator.py similarity index 99% rename from selftests/unit/test_utils_diff_validator.py rename to selftests/unit/utils/test_diff_validator.py index d60bc4194e..9d79af4e85 100644 --- a/selftests/unit/test_utils_diff_validator.py +++ b/selftests/unit/utils/test_diff_validator.py @@ -6,7 +6,7 @@ from avocado.utils import diff_validator -from .. import temp_dir_prefix +from ... import temp_dir_prefix class ChangeValidationTest(unittest.TestCase): diff --git a/selftests/unit/test_utils_disk.py b/selftests/unit/utils/test_disk.py similarity index 100% rename from selftests/unit/test_utils_disk.py rename to selftests/unit/utils/test_disk.py diff --git a/selftests/unit/test_utils_filelock.py b/selftests/unit/utils/test_filelock.py similarity index 97% rename from selftests/unit/test_utils_filelock.py rename to selftests/unit/utils/test_filelock.py index d38357231b..23576bbecb 100644 --- a/selftests/unit/test_utils_filelock.py +++ b/selftests/unit/utils/test_filelock.py @@ -4,7 +4,7 @@ from avocado.utils.filelock import AlreadyLocked, FileLock -from .. import temp_dir_prefix +from ... import temp_dir_prefix class TestFileLock(unittest.TestCase): diff --git a/selftests/unit/test_utils_genio.py b/selftests/unit/utils/test_genio.py similarity index 96% rename from selftests/unit/test_utils_genio.py rename to selftests/unit/utils/test_genio.py index b69a0a69b7..5fb77ddebe 100644 --- a/selftests/unit/test_utils_genio.py +++ b/selftests/unit/utils/test_genio.py @@ -6,7 +6,7 @@ from avocado.utils import genio -from .. import setup_avocado_loggers, temp_dir_prefix +from ... import setup_avocado_loggers, temp_dir_prefix setup_avocado_loggers() diff --git a/selftests/unit/test_utils_iso9660.py b/selftests/unit/utils/test_iso9660.py similarity index 92% rename from selftests/unit/test_utils_iso9660.py rename to selftests/unit/utils/test_iso9660.py index e058effa98..abd76252d1 100644 --- a/selftests/unit/test_utils_iso9660.py +++ b/selftests/unit/utils/test_iso9660.py @@ -7,7 +7,7 @@ from avocado.utils import iso9660, process -from .. import setup_avocado_loggers, temp_dir_prefix +from ... import setup_avocado_loggers, temp_dir_prefix setup_avocado_loggers() @@ -15,9 +15,9 @@ class Capabilities(unittest.TestCase): def setUp(self): - self.iso_path = os.path.abspath(os.path.join(os.path.dirname(__file__), - os.path.pardir, ".data", - "sample.iso")) + self.iso_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.dirname(__file__)), + os.path.pardir, ".data", "sample.iso")) @unittest.mock.patch('avocado.utils.iso9660.has_pycdlib', return_value=True) def test_capabilities_pycdlib(self, has_pycdlib_mocked): @@ -49,9 +49,9 @@ class BaseIso9660: """ def setUp(self): - self.iso_path = os.path.abspath(os.path.join(os.path.dirname(__file__), - os.path.pardir, ".data", - "sample.iso")) + self.iso_path = os.path.abspath( + os.path.join(os.path.dirname(os.path.dirname(__file__)), + os.path.pardir, ".data", "sample.iso")) self.iso = None prefix = temp_dir_prefix(__name__, self, 'setUp') self.tmpdir = tempfile.TemporaryDirectory(prefix=prefix) diff --git a/selftests/unit/test_utils_kernel.py b/selftests/unit/utils/test_kernel.py similarity index 95% rename from selftests/unit/test_utils_kernel.py rename to selftests/unit/utils/test_kernel.py index 4f9cc4229e..b06f8a77ae 100644 --- a/selftests/unit/test_utils_kernel.py +++ b/selftests/unit/utils/test_kernel.py @@ -2,7 +2,7 @@ from avocado.utils.kernel import KernelBuild -from .. import setup_avocado_loggers +from ... import setup_avocado_loggers setup_avocado_loggers() diff --git a/selftests/unit/test_utils_linux_modules.py b/selftests/unit/utils/test_linux_modules.py similarity index 100% rename from selftests/unit/test_utils_linux_modules.py rename to selftests/unit/utils/test_linux_modules.py diff --git a/selftests/unit/test_utils_linux_modules.py.data/lsmod b/selftests/unit/utils/test_linux_modules.py.data/lsmod similarity index 100% rename from selftests/unit/test_utils_linux_modules.py.data/lsmod rename to selftests/unit/utils/test_linux_modules.py.data/lsmod diff --git a/selftests/unit/test_utils_linux_modules.py.data/proc_modules b/selftests/unit/utils/test_linux_modules.py.data/proc_modules similarity index 100% rename from selftests/unit/test_utils_linux_modules.py.data/proc_modules rename to selftests/unit/utils/test_linux_modules.py.data/proc_modules diff --git a/selftests/unit/test_utils_memory.py b/selftests/unit/utils/test_memory.py similarity index 100% rename from selftests/unit/test_utils_memory.py rename to selftests/unit/utils/test_memory.py diff --git a/selftests/unit/test_utils_network.py b/selftests/unit/utils/test_network.py similarity index 100% rename from selftests/unit/test_utils_network.py rename to selftests/unit/utils/test_network.py diff --git a/selftests/unit/test_utils_output.py b/selftests/unit/utils/test_output.py similarity index 100% rename from selftests/unit/test_utils_output.py rename to selftests/unit/utils/test_output.py diff --git a/selftests/unit/test_utils_partition.py b/selftests/unit/utils/test_partition.py similarity index 99% rename from selftests/unit/test_utils_partition.py rename to selftests/unit/utils/test_partition.py index 1965f39839..265013631b 100644 --- a/selftests/unit/test_utils_partition.py +++ b/selftests/unit/utils/test_partition.py @@ -13,7 +13,7 @@ from avocado.utils import path as utils_path from avocado.utils import process, wait -from .. import temp_dir_prefix +from ... import temp_dir_prefix def missing_binary(binary): diff --git a/selftests/unit/test_utils_path.py b/selftests/unit/utils/test_path.py similarity index 100% rename from selftests/unit/test_utils_path.py rename to selftests/unit/utils/test_path.py diff --git a/selftests/unit/test_utils_pci.py b/selftests/unit/utils/test_pci.py similarity index 100% rename from selftests/unit/test_utils_pci.py rename to selftests/unit/utils/test_pci.py diff --git a/selftests/unit/test_utils_pmem.py b/selftests/unit/utils/test_pmem.py similarity index 100% rename from selftests/unit/test_utils_pmem.py rename to selftests/unit/utils/test_pmem.py diff --git a/selftests/unit/test_utils_process.py b/selftests/unit/utils/test_process.py similarity index 99% rename from selftests/unit/test_utils_process.py rename to selftests/unit/utils/test_process.py index 0167ba07c5..6ec6a01e56 100644 --- a/selftests/unit/test_utils_process.py +++ b/selftests/unit/utils/test_process.py @@ -7,8 +7,8 @@ from avocado.utils import path, process, script -from .. import (setup_avocado_loggers, skipOnLevelsInferiorThan, - skipUnlessPathExists) +from ... import (setup_avocado_loggers, skipOnLevelsInferiorThan, + skipUnlessPathExists) setup_avocado_loggers() diff --git a/selftests/unit/test_utils_script.py b/selftests/unit/utils/test_script.py similarity index 100% rename from selftests/unit/test_utils_script.py rename to selftests/unit/utils/test_script.py diff --git a/selftests/unit/test_utils_service.py b/selftests/unit/utils/test_service.py similarity index 99% rename from selftests/unit/test_utils_service.py rename to selftests/unit/utils/test_service.py index 7079bb12f4..78fe2ceb27 100644 --- a/selftests/unit/test_utils_service.py +++ b/selftests/unit/utils/test_service.py @@ -20,7 +20,7 @@ from avocado.utils import service -from .. import setup_avocado_loggers +from ... import setup_avocado_loggers setup_avocado_loggers() diff --git a/selftests/unit/test_utils_software_manager.py b/selftests/unit/utils/test_software_manager.py similarity index 95% rename from selftests/unit/test_utils_software_manager.py rename to selftests/unit/utils/test_software_manager.py index 75431ece9f..e6b372e899 100644 --- a/selftests/unit/test_utils_software_manager.py +++ b/selftests/unit/utils/test_software_manager.py @@ -3,7 +3,7 @@ from avocado.utils import distro, software_manager -from .. import setup_avocado_loggers +from ... import setup_avocado_loggers setup_avocado_loggers() diff --git a/selftests/unit/test_utils_ssh.py b/selftests/unit/utils/test_ssh.py similarity index 100% rename from selftests/unit/test_utils_ssh.py rename to selftests/unit/utils/test_ssh.py diff --git a/selftests/unit/test_utils_stacktrace.py b/selftests/unit/utils/test_stacktrace.py similarity index 100% rename from selftests/unit/test_utils_stacktrace.py rename to selftests/unit/utils/test_stacktrace.py diff --git a/selftests/unit/test_utils_vmimage.py b/selftests/unit/utils/test_vmimage.py similarity index 99% rename from selftests/unit/test_utils_vmimage.py rename to selftests/unit/utils/test_vmimage.py index 270a2c278d..079b14364f 100644 --- a/selftests/unit/test_utils_vmimage.py +++ b/selftests/unit/utils/test_vmimage.py @@ -3,7 +3,7 @@ from avocado.utils import vmimage -from .. import setup_avocado_loggers +from ... import setup_avocado_loggers setup_avocado_loggers()