diff --git a/README.md b/README.md index 9c91110b..f052db96 100644 --- a/README.md +++ b/README.md @@ -634,7 +634,7 @@ python manage.py test # all tests, including vrtManager ruff check . ``` -The suite includes mocked regression tests and disk/clone tests on libvirt's in-process `test:///default` driver. Set `WEBVIRTCLOUD_DB_HOST` (and the other `WEBVIRTCLOUD_DB_*` variables) to run it against PostgreSQL, as CI does. +Each app keeps its tests in a `tests/` package, so `python manage.py test instances` runs one app. The suite includes mocked regression tests and disk/clone tests on libvirt's in-process `test:///default` driver. Set `WEBVIRTCLOUD_DB_HOST` (and the other `WEBVIRTCLOUD_DB_*` variables) to run it against PostgreSQL, as CI does. The compute tests try a local libvirt and skip when none answers; the instance tests run only when `TEST_LIBVIRT_HOST` is set. A green result with skips does not establish live KVM compatibility. The instance tests create `wvc-test-*` VMs and a temporary `wvc-test` pool (`/var/lib/libvirt/wvc-test`), remove them afterwards, and fail if any other VM or volume on the host changed: diff --git a/accounts/tests/__init__.py b/accounts/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/accounts/test_admin_email_otp.py b/accounts/tests/test_admin_email_otp.py similarity index 100% rename from accounts/test_admin_email_otp.py rename to accounts/tests/test_admin_email_otp.py diff --git a/accounts/test_admin_password.py b/accounts/tests/test_admin_password.py similarity index 100% rename from accounts/test_admin_password.py rename to accounts/tests/test_admin_password.py diff --git a/accounts/test_change_password_permission.py b/accounts/tests/test_change_password_permission.py similarity index 100% rename from accounts/test_change_password_permission.py rename to accounts/tests/test_change_password_permission.py diff --git a/accounts/test_checks.py b/accounts/tests/test_checks.py similarity index 100% rename from accounts/test_checks.py rename to accounts/tests/test_checks.py diff --git a/accounts/test_email_otp.py b/accounts/tests/test_email_otp.py similarity index 100% rename from accounts/test_email_otp.py rename to accounts/tests/test_email_otp.py diff --git a/accounts/test_first_login_password.py b/accounts/tests/test_first_login_password.py similarity index 100% rename from accounts/test_first_login_password.py rename to accounts/tests/test_first_login_password.py diff --git a/accounts/test_login_lockout.py b/accounts/tests/test_login_lockout.py similarity index 100% rename from accounts/test_login_lockout.py rename to accounts/tests/test_login_lockout.py diff --git a/accounts/test_otp_login.py b/accounts/tests/test_otp_login.py similarity index 100% rename from accounts/test_otp_login.py rename to accounts/tests/test_otp_login.py diff --git a/accounts/test_security_fixes.py b/accounts/tests/test_security_fixes.py similarity index 100% rename from accounts/test_security_fixes.py rename to accounts/tests/test_security_fixes.py diff --git a/accounts/test_utils.py b/accounts/tests/test_utils.py similarity index 100% rename from accounts/test_utils.py rename to accounts/tests/test_utils.py diff --git a/accounts/tests.py b/accounts/tests/test_views.py similarity index 100% rename from accounts/tests.py rename to accounts/tests/test_views.py diff --git a/admin/tests/__init__.py b/admin/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/admin/test_tombstones.py b/admin/tests/test_tombstones.py similarity index 100% rename from admin/test_tombstones.py rename to admin/tests/test_tombstones.py diff --git a/admin/test_user_create.py b/admin/tests/test_user_create.py similarity index 100% rename from admin/test_user_create.py rename to admin/tests/test_user_create.py diff --git a/admin/test_user_update_next.py b/admin/tests/test_user_update_next.py similarity index 100% rename from admin/test_user_update_next.py rename to admin/tests/test_user_update_next.py diff --git a/admin/tests.py b/admin/tests/test_views.py similarity index 100% rename from admin/tests.py rename to admin/tests/test_views.py diff --git a/appsettings/tests.py b/appsettings/tests.py deleted file mode 100644 index 49290204..00000000 --- a/appsettings/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/appsettings/tests/__init__.py b/appsettings/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/appsettings/test_appsettings.py b/appsettings/tests/test_appsettings.py similarity index 100% rename from appsettings/test_appsettings.py rename to appsettings/tests/test_appsettings.py diff --git a/appsettings/test_get_settings.py b/appsettings/tests/test_get_settings.py similarity index 100% rename from appsettings/test_get_settings.py rename to appsettings/tests/test_get_settings.py diff --git a/appsettings/test_migrations.py b/appsettings/tests/test_migrations.py similarity index 100% rename from appsettings/test_migrations.py rename to appsettings/tests/test_migrations.py diff --git a/appsettings/test_theme_name.py b/appsettings/tests/test_theme_name.py similarity index 100% rename from appsettings/test_theme_name.py rename to appsettings/tests/test_theme_name.py diff --git a/appsettings/test_themes.py b/appsettings/tests/test_themes.py similarity index 100% rename from appsettings/test_themes.py rename to appsettings/tests/test_themes.py diff --git a/computes/tests/__init__.py b/computes/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/computes/test_api_security.py b/computes/tests/test_api_security.py similarity index 100% rename from computes/test_api_security.py rename to computes/tests/test_api_security.py diff --git a/computes/test_compute_password.py b/computes/tests/test_compute_password.py similarity index 100% rename from computes/test_compute_password.py rename to computes/tests/test_compute_password.py diff --git a/computes/test_cpu_graph.py b/computes/tests/test_cpu_graph.py similarity index 100% rename from computes/test_cpu_graph.py rename to computes/tests/test_cpu_graph.py diff --git a/computes/test_migration_address.py b/computes/tests/test_migration_address.py similarity index 100% rename from computes/test_migration_address.py rename to computes/tests/test_migration_address.py diff --git a/computes/test_operation_locks.py b/computes/tests/test_operation_locks.py similarity index 100% rename from computes/test_operation_locks.py rename to computes/tests/test_operation_locks.py diff --git a/computes/test_overview_status.py b/computes/tests/test_overview_status.py similarity index 100% rename from computes/test_overview_status.py rename to computes/tests/test_overview_status.py diff --git a/computes/test_ownership.py b/computes/tests/test_ownership.py similarity index 100% rename from computes/test_ownership.py rename to computes/tests/test_ownership.py diff --git a/computes/test_quota_down_host.py b/computes/tests/test_quota_down_host.py similarity index 100% rename from computes/test_quota_down_host.py rename to computes/tests/test_quota_down_host.py diff --git a/computes/test_reconciliation.py b/computes/tests/test_reconciliation.py similarity index 100% rename from computes/test_reconciliation.py rename to computes/tests/test_reconciliation.py diff --git a/computes/test_validators.py b/computes/tests/test_validators.py similarity index 100% rename from computes/test_validators.py rename to computes/tests/test_validators.py diff --git a/computes/tests.py b/computes/tests/test_views.py similarity index 99% rename from computes/tests.py rename to computes/tests/test_views.py index df3be415..7d6b0683 100644 --- a/computes/tests.py +++ b/computes/tests/test_views.py @@ -4,7 +4,7 @@ from django.shortcuts import reverse from django.test import RequestFactory, TestCase, TransactionTestCase from vrtManager.connection import CONN_SOCKET, connection_manager -from .models import Compute +from computes.models import Compute TEST_COMPUTE_HOST = os.environ.get("TEST_LIBVIRT_HOST", "localhost") TEST_COMPUTE_LOGIN = os.environ.get("TEST_LIBVIRT_LOGIN", "") diff --git a/console/tests/__init__.py b/console/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/console/test_cli_parsers.py b/console/tests/test_cli_parsers.py similarity index 100% rename from console/test_cli_parsers.py rename to console/tests/test_cli_parsers.py diff --git a/console/test_socketiod_child.py b/console/tests/test_socketiod_child.py similarity index 98% rename from console/test_socketiod_child.py rename to console/tests/test_socketiod_child.py index 86480c49..e3d3f0bf 100644 --- a/console/test_socketiod_child.py +++ b/console/tests/test_socketiod_child.py @@ -16,7 +16,7 @@ try: except ImportError: # pragma: no cover socketio = None -ROOT = Path(__file__).resolve().parent.parent +ROOT = Path(__file__).resolve().parent.parent.parent SOCKETIOD = ROOT / "console" / "socketiod" diff --git a/console/test_socketiod_disabled.py b/console/tests/test_socketiod_disabled.py similarity index 96% rename from console/test_socketiod_disabled.py rename to console/tests/test_socketiod_disabled.py index 16cb2741..b1409804 100644 --- a/console/test_socketiod_disabled.py +++ b/console/tests/test_socketiod_disabled.py @@ -5,7 +5,7 @@ import tempfile import unittest from pathlib import Path -ROOT = Path(__file__).resolve().parent.parent +ROOT = Path(__file__).resolve().parent.parent.parent SOCKETIOD = ROOT / "console" / "socketiod" diff --git a/console/tests.py b/console/tests/test_views.py similarity index 99% rename from console/tests.py rename to console/tests/test_views.py index 8e62f69c..44a88d64 100644 --- a/console/tests.py +++ b/console/tests/test_views.py @@ -16,7 +16,7 @@ from instances.models import Instance from libvirt import libvirtError # Dynamically load console/novncd script for testing -NOVNCD_PATH = str(Path(__file__).resolve().parent / "novncd") +NOVNCD_PATH = str(Path(__file__).resolve().parent.parent / "novncd") _loader = importlib.machinery.SourceFileLoader("novncd_mod", NOVNCD_PATH) _spec = importlib.util.spec_from_file_location( "novncd_mod", NOVNCD_PATH, loader=_loader diff --git a/datasource/tests.py b/datasource/tests.py deleted file mode 100644 index 49290204..00000000 --- a/datasource/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/datasource/tests/__init__.py b/datasource/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/datasource/test_datasource.py b/datasource/tests/test_datasource.py similarity index 100% rename from datasource/test_datasource.py rename to datasource/tests/test_datasource.py diff --git a/instances/tests/__init__.py b/instances/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/instances/livetest.py b/instances/tests/livetest.py similarity index 100% rename from instances/livetest.py rename to instances/tests/livetest.py diff --git a/instances/test_change_network.py b/instances/tests/test_change_network.py similarity index 100% rename from instances/test_change_network.py rename to instances/tests/test_change_network.py diff --git a/instances/test_change_xml.py b/instances/tests/test_change_xml.py similarity index 100% rename from instances/test_change_xml.py rename to instances/tests/test_change_xml.py diff --git a/instances/test_clone_disks.py b/instances/tests/test_clone_disks.py similarity index 100% rename from instances/test_clone_disks.py rename to instances/tests/test_clone_disks.py diff --git a/instances/test_clone_permission.py b/instances/tests/test_clone_permission.py similarity index 100% rename from instances/test_clone_permission.py rename to instances/tests/test_clone_permission.py diff --git a/instances/test_console_listener.py b/instances/tests/test_console_listener.py similarity index 100% rename from instances/test_console_listener.py rename to instances/tests/test_console_listener.py diff --git a/instances/test_console_rule.py b/instances/tests/test_console_rule.py similarity index 100% rename from instances/test_console_rule.py rename to instances/tests/test_console_rule.py diff --git a/instances/test_console_settings_access.py b/instances/tests/test_console_settings_access.py similarity index 100% rename from instances/test_console_settings_access.py rename to instances/tests/test_console_settings_access.py diff --git a/instances/test_create_dialog_cpu.py b/instances/tests/test_create_dialog_cpu.py similarity index 100% rename from instances/test_create_dialog_cpu.py rename to instances/tests/test_create_dialog_cpu.py diff --git a/instances/test_create_instance.py b/instances/tests/test_create_instance.py similarity index 100% rename from instances/test_create_instance.py rename to instances/tests/test_create_instance.py diff --git a/instances/test_create_rollback.py b/instances/tests/test_create_rollback.py similarity index 100% rename from instances/test_create_rollback.py rename to instances/tests/test_create_rollback.py diff --git a/instances/test_create_wizard_url.py b/instances/tests/test_create_wizard_url.py similarity index 100% rename from instances/test_create_wizard_url.py rename to instances/tests/test_create_wizard_url.py diff --git a/instances/test_destroy.py b/instances/tests/test_destroy.py similarity index 100% rename from instances/test_destroy.py rename to instances/tests/test_destroy.py diff --git a/instances/test_detail_reads.py b/instances/tests/test_detail_reads.py similarity index 100% rename from instances/test_detail_reads.py rename to instances/tests/test_detail_reads.py diff --git a/instances/test_detail_unreachable.py b/instances/tests/test_detail_unreachable.py similarity index 100% rename from instances/test_detail_unreachable.py rename to instances/tests/test_detail_unreachable.py diff --git a/instances/test_disk_isolation.py b/instances/tests/test_disk_isolation.py similarity index 100% rename from instances/test_disk_isolation.py rename to instances/tests/test_disk_isolation.py diff --git a/instances/test_drbd_target.py b/instances/tests/test_drbd_target.py similarity index 100% rename from instances/test_drbd_target.py rename to instances/tests/test_drbd_target.py diff --git a/instances/test_error_handling.py b/instances/tests/test_error_handling.py similarity index 100% rename from instances/test_error_handling.py rename to instances/tests/test_error_handling.py diff --git a/instances/test_gstfsd.py b/instances/tests/test_gstfsd.py similarity index 99% rename from instances/test_gstfsd.py rename to instances/tests/test_gstfsd.py index 93142d5c..f1a691e8 100644 --- a/instances/test_gstfsd.py +++ b/instances/tests/test_gstfsd.py @@ -8,7 +8,7 @@ import time import unittest from pathlib import Path -GSTFSD = Path(__file__).resolve().parent.parent / "conf" / "daemon" / "gstfsd" +GSTFSD = Path(__file__).resolve().parent.parent.parent / "conf" / "daemon" / "gstfsd" # A stand-in for libguestfs: the guest's operating systems ("roots", each with # its mountpoints), its files, and what is mounted live in a JSON file. diff --git a/instances/test_index.py b/instances/tests/test_index.py similarity index 100% rename from instances/test_index.py rename to instances/tests/test_index.py diff --git a/instances/test_index_host_alerts.py b/instances/tests/test_index_host_alerts.py similarity index 100% rename from instances/test_index_host_alerts.py rename to instances/tests/test_index_host_alerts.py diff --git a/instances/test_list_rpc.py b/instances/tests/test_list_rpc.py similarity index 100% rename from instances/test_list_rpc.py rename to instances/tests/test_list_rpc.py diff --git a/instances/test_list_unreachable.py b/instances/tests/test_list_unreachable.py similarity index 100% rename from instances/test_list_unreachable.py rename to instances/tests/test_list_unreachable.py diff --git a/instances/test_live_clone.py b/instances/tests/test_live_clone.py similarity index 100% rename from instances/test_live_clone.py rename to instances/tests/test_live_clone.py diff --git a/instances/test_live_create.py b/instances/tests/test_live_create.py similarity index 99% rename from instances/test_live_create.py rename to instances/tests/test_live_create.py index 5f9bbe4b..0b45d86d 100644 --- a/instances/test_live_create.py +++ b/instances/tests/test_live_create.py @@ -1,6 +1,6 @@ """Live checks that a failed VM creation leaves no volumes behind. -Runs only with TEST_LIBVIRT_HOST set (see instances/livetest.py). +Runs only with TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). """ import os diff --git a/instances/test_live_dataloss.py b/instances/tests/test_live_dataloss.py similarity index 99% rename from instances/test_live_dataloss.py rename to instances/tests/test_live_dataloss.py index 72315563..6e131c1f 100644 --- a/instances/test_live_dataloss.py +++ b/instances/tests/test_live_dataloss.py @@ -3,7 +3,7 @@ Each test asserts the safe behavior. Known unfixed cases are marked expectedFailure; a fix turns them into unexpected successes, which fail the run until the marker is removed. Runs only with -TEST_LIBVIRT_HOST set (see instances/livetest.py). +TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). """ import os @@ -18,8 +18,8 @@ from django.urls import reverse from vrtManager.connection import connection_manager from . import livetest -from .models import Instance -from .utils import refr +from instances.models import Instance +from instances.utils import refr P = livetest.PREFIX diff --git a/instances/test_live_disk_resize.py b/instances/tests/test_live_disk_resize.py similarity index 99% rename from instances/test_live_disk_resize.py rename to instances/tests/test_live_disk_resize.py index 3da911e6..ca4c84b1 100644 --- a/instances/test_live_disk_resize.py +++ b/instances/tests/test_live_disk_resize.py @@ -2,7 +2,7 @@ QEMU holds a running domain's image, so the size goes through blockResize; the guest and the volume must both see it, and the persistent definition -stays as it was. Runs only with TEST_LIBVIRT_HOST set (see instances/livetest.py). +stays as it was. Runs only with TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). """ import os diff --git a/instances/test_live_guest.py b/instances/tests/test_live_guest.py similarity index 99% rename from instances/test_live_guest.py rename to instances/tests/test_live_guest.py index 1ffd3ec9..3eb8d038 100644 --- a/instances/test_live_guest.py +++ b/instances/tests/test_live_guest.py @@ -6,7 +6,7 @@ with qemu-guest-agent enabled. The tests boot wvc-test VMs from qcow2 overlays in the test pool, so the image itself is only read. They are skipped while a running VM uses the image, since its content would change under the overlays. Runs only with TEST_LIBVIRT_HOST set as well (see -instances/livetest.py). +instances/tests/livetest.py). """ import json @@ -24,8 +24,8 @@ from lxml import etree from vrtManager.connection import connection_manager from . import livetest -from .models import Instance -from .utils import refr +from instances.models import Instance +from instances.utils import refr P = livetest.PREFIX BOOT_TIMEOUT = 300 diff --git a/instances/test_live_iso.py b/instances/tests/test_live_iso.py similarity index 100% rename from instances/test_live_iso.py rename to instances/tests/test_live_iso.py diff --git a/instances/test_live_xml.py b/instances/tests/test_live_xml.py similarity index 98% rename from instances/test_live_xml.py rename to instances/tests/test_live_xml.py index c88e5276..525dce71 100644 --- a/instances/test_live_xml.py +++ b/instances/tests/test_live_xml.py @@ -2,7 +2,7 @@ Every edit that redefines the domain must start from the persistent definition with secrets (VIR_DOMAIN_XML_INACTIVE | VIR_DOMAIN_XML_SECURE). -Runs only with TEST_LIBVIRT_HOST set (see instances/livetest.py). +Runs only with TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). """ import os diff --git a/instances/test_live_xml_effects.py b/instances/tests/test_live_xml_effects.py similarity index 99% rename from instances/test_live_xml_effects.py rename to instances/tests/test_live_xml_effects.py index 52e96fa1..2e283195 100644 --- a/instances/test_live_xml_effects.py +++ b/instances/tests/test_live_xml_effects.py @@ -5,7 +5,7 @@ before and after. The edit must show its effect, and once the nodes it is allowed to touch are removed from both sides, the rest of the definition must be identical: unknown elements, secrets and pending changes survive. On a running VM, edits of the persistent definition must leave the live -one alone. Runs only with TEST_LIBVIRT_HOST set (see instances/livetest.py). +one alone. Runs only with TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). """ import os diff --git a/instances/test_migrate_form.py b/instances/tests/test_migrate_form.py similarity index 100% rename from instances/test_migrate_form.py rename to instances/tests/test_migrate_form.py diff --git a/instances/test_migration_bookkeeping.py b/instances/tests/test_migration_bookkeeping.py similarity index 100% rename from instances/test_migration_bookkeeping.py rename to instances/tests/test_migration_bookkeeping.py diff --git a/instances/test_migration_log.py b/instances/tests/test_migration_log.py similarity index 100% rename from instances/test_migration_log.py rename to instances/tests/test_migration_log.py diff --git a/instances/test_missing_fields.py b/instances/tests/test_missing_fields.py similarity index 100% rename from instances/test_missing_fields.py rename to instances/tests/test_missing_fields.py diff --git a/instances/test_moved_while_waiting.py b/instances/tests/test_moved_while_waiting.py similarity index 100% rename from instances/test_moved_while_waiting.py rename to instances/tests/test_moved_while_waiting.py diff --git a/instances/test_new_disk_name.py b/instances/tests/test_new_disk_name.py similarity index 100% rename from instances/test_new_disk_name.py rename to instances/tests/test_new_disk_name.py diff --git a/instances/test_page_controls.py b/instances/tests/test_page_controls.py similarity index 100% rename from instances/test_page_controls.py rename to instances/tests/test_page_controls.py diff --git a/instances/test_pending_edits.py b/instances/tests/test_pending_edits.py similarity index 100% rename from instances/test_pending_edits.py rename to instances/tests/test_pending_edits.py diff --git a/instances/test_quota.py b/instances/tests/test_quota.py similarity index 100% rename from instances/test_quota.py rename to instances/tests/test_quota.py diff --git a/instances/test_quota_lock.py b/instances/tests/test_quota_lock.py similarity index 100% rename from instances/test_quota_lock.py rename to instances/tests/test_quota_lock.py diff --git a/instances/test_root_pass.py b/instances/tests/test_root_pass.py similarity index 100% rename from instances/test_root_pass.py rename to instances/tests/test_root_pass.py diff --git a/instances/test_security_mutations.py b/instances/tests/test_security_mutations.py similarity index 100% rename from instances/test_security_mutations.py rename to instances/tests/test_security_mutations.py diff --git a/instances/test_states.py b/instances/tests/test_states.py similarity index 100% rename from instances/test_states.py rename to instances/tests/test_states.py diff --git a/instances/test_stats_sample.py b/instances/tests/test_stats_sample.py similarity index 100% rename from instances/test_stats_sample.py rename to instances/tests/test_stats_sample.py diff --git a/instances/test_template_flag.py b/instances/tests/test_template_flag.py similarity index 100% rename from instances/test_template_flag.py rename to instances/tests/test_template_flag.py diff --git a/instances/test_template_quota.py b/instances/tests/test_template_quota.py similarity index 100% rename from instances/test_template_quota.py rename to instances/tests/test_template_quota.py diff --git a/instances/test_template_rules.py b/instances/tests/test_template_rules.py similarity index 100% rename from instances/test_template_rules.py rename to instances/tests/test_template_rules.py diff --git a/instances/test_update_console.py b/instances/tests/test_update_console.py similarity index 100% rename from instances/test_update_console.py rename to instances/tests/test_update_console.py diff --git a/instances/tests.py b/instances/tests/test_views.py similarity index 99% rename from instances/tests.py rename to instances/tests/test_views.py index f1903cd3..d94a60d5 100644 --- a/instances/tests.py +++ b/instances/tests/test_views.py @@ -14,8 +14,8 @@ from vrtManager.create import wvmCreate from vrtManager.util import randomUUID from . import livetest -from .models import Flavor, Instance -from .utils import refr +from instances.models import Flavor, Instance +from instances.utils import refr TEST_COMPUTE_HOST = os.environ.get("TEST_LIBVIRT_HOST", "localhost") TEST_COMPUTE_LOGIN = os.environ.get("TEST_LIBVIRT_LOGIN", "") diff --git a/instances/test_xss.py b/instances/tests/test_xss.py similarity index 99% rename from instances/test_xss.py rename to instances/tests/test_xss.py index 962e0864..3027e81d 100644 --- a/instances/test_xss.py +++ b/instances/tests/test_xss.py @@ -15,7 +15,7 @@ from accounts.models import UserInstance, UserSSHKey from computes.models import Compute from instances.models import Instance -ROOT = Path(__file__).resolve().parent.parent +ROOT = Path(__file__).resolve().parent.parent.parent PAYLOAD = "" diff --git a/interfaces/tests.py b/interfaces/tests.py deleted file mode 100644 index 49290204..00000000 --- a/interfaces/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/interfaces/tests/__init__.py b/interfaces/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/interfaces/test_forms.py b/interfaces/tests/test_forms.py similarity index 100% rename from interfaces/test_forms.py rename to interfaces/tests/test_forms.py diff --git a/interfaces/test_live_interfaces.py b/interfaces/tests/test_live_interfaces.py similarity index 100% rename from interfaces/test_live_interfaces.py rename to interfaces/tests/test_live_interfaces.py diff --git a/logs/tests.py b/logs/tests.py deleted file mode 100644 index 49290204..00000000 --- a/logs/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/logs/tests/__init__.py b/logs/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/logs/test_logs.py b/logs/tests/test_logs.py similarity index 100% rename from logs/test_logs.py rename to logs/tests/test_logs.py diff --git a/networks/tests.py b/networks/tests.py deleted file mode 100644 index 49290204..00000000 --- a/networks/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/nwfilters/tests/__init__.py b/nwfilters/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nwfilters/tests.py b/nwfilters/tests/test_views.py similarity index 100% rename from nwfilters/tests.py rename to nwfilters/tests/test_views.py diff --git a/pyproject.toml b/pyproject.toml index 960e0712..0442136e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ select = ["E9", "F"] [tool.coverage.run] source = ["."] -omit = [".venv/*", "*/migrations/*", "*/test*.py", "*/tests.py", "manage.py", "webvirtcloud/settings*.py"] +omit = [".venv/*", "*/migrations/*", "*/tests/*", "manage.py", "webvirtcloud/settings*.py"] [tool.coverage.report] # Measured 51% without the live libvirt suite (2026-10-03); raise as tests grow. diff --git a/storages/tests/__init__.py b/storages/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/storages/test_pool_target.py b/storages/tests/test_pool_target.py similarity index 100% rename from storages/test_pool_target.py rename to storages/tests/test_pool_target.py diff --git a/storages/test_sftp_pipelined.py b/storages/tests/test_sftp_pipelined.py similarity index 100% rename from storages/test_sftp_pipelined.py rename to storages/tests/test_sftp_pipelined.py diff --git a/storages/test_ssh_pool.py b/storages/tests/test_ssh_pool.py similarity index 100% rename from storages/test_ssh_pool.py rename to storages/tests/test_ssh_pool.py diff --git a/storages/tests.py b/storages/tests/test_views.py similarity index 100% rename from storages/tests.py rename to storages/tests/test_views.py diff --git a/virtsecrets/tests.py b/virtsecrets/tests.py deleted file mode 100644 index 49290204..00000000 --- a/virtsecrets/tests.py +++ /dev/null @@ -1,2 +0,0 @@ - -# Create your tests here. diff --git a/vrtManager/tests/__init__.py b/vrtManager/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vrtManager/test_change_network.py b/vrtManager/tests/test_change_network.py similarity index 100% rename from vrtManager/test_change_network.py rename to vrtManager/tests/test_change_network.py diff --git a/vrtManager/test_clone_nvram.py b/vrtManager/tests/test_clone_nvram.py similarity index 100% rename from vrtManager/test_clone_nvram.py rename to vrtManager/tests/test_clone_nvram.py diff --git a/vrtManager/test_connection.py b/vrtManager/tests/test_connection.py similarity index 100% rename from vrtManager/test_connection.py rename to vrtManager/tests/test_connection.py diff --git a/vrtManager/test_console_setters.py b/vrtManager/tests/test_console_setters.py similarity index 100% rename from vrtManager/test_console_setters.py rename to vrtManager/tests/test_console_setters.py diff --git a/vrtManager/test_device_edits.py b/vrtManager/tests/test_device_edits.py similarity index 100% rename from vrtManager/test_device_edits.py rename to vrtManager/tests/test_device_edits.py diff --git a/vrtManager/test_dhcp_leases.py b/vrtManager/tests/test_dhcp_leases.py similarity index 100% rename from vrtManager/test_dhcp_leases.py rename to vrtManager/tests/test_dhcp_leases.py diff --git a/vrtManager/test_host_reads.py b/vrtManager/tests/test_host_reads.py similarity index 100% rename from vrtManager/test_host_reads.py rename to vrtManager/tests/test_host_reads.py diff --git a/vrtManager/test_instance_getters.py b/vrtManager/tests/test_instance_getters.py similarity index 100% rename from vrtManager/test_instance_getters.py rename to vrtManager/tests/test_instance_getters.py diff --git a/vrtManager/test_interface_addresses.py b/vrtManager/tests/test_interface_addresses.py similarity index 100% rename from vrtManager/test_interface_addresses.py rename to vrtManager/tests/test_interface_addresses.py diff --git a/vrtManager/test_iso_media.py b/vrtManager/tests/test_iso_media.py similarity index 100% rename from vrtManager/test_iso_media.py rename to vrtManager/tests/test_iso_media.py diff --git a/vrtManager/test_live_connection.py b/vrtManager/tests/test_live_connection.py similarity index 99% rename from vrtManager/test_live_connection.py rename to vrtManager/tests/test_live_connection.py index 9e0974af..d3c99b7a 100644 --- a/vrtManager/test_live_connection.py +++ b/vrtManager/tests/test_live_connection.py @@ -1,6 +1,6 @@ """Live checks of bounded connection opens against real libvirt. -Runs only with TEST_LIBVIRT_HOST set (a TCP compute, see instances/livetest.py); +Runs only with TEST_LIBVIRT_HOST set (a TCP compute, see instances/tests/livetest.py); TEST_LIBVIRT_SSH_HOST/_LOGIN add a reachable ssh compute. 192.0.2.1 is TEST-NET-1: SYN packets to it are dropped, as for a host that went away without a trace. diff --git a/vrtManager/test_live_nvram.py b/vrtManager/tests/test_live_nvram.py similarity index 96% rename from vrtManager/test_live_nvram.py rename to vrtManager/tests/test_live_nvram.py index 79b36c25..b30574a0 100644 --- a/vrtManager/test_live_nvram.py +++ b/vrtManager/tests/test_live_nvram.py @@ -1,7 +1,7 @@ """Live check that the NVRAM file a migrated VM leaves behind is removed, and kept when the destination sees the same directory. -Runs only with TEST_LIBVIRT_HOST set (see instances/livetest.py). The +Runs only with TEST_LIBVIRT_HOST set (see instances/tests/livetest.py). The deletion needs a second host: TEST_LIBVIRT_SSH_HOST (and _LOGIN). """ @@ -12,7 +12,7 @@ import libvirt from django.test import SimpleTestCase from lxml import etree -from instances import livetest +from instances.tests import livetest from vrtManager.connection import CONN_SSH, NVRAM_DIR, connection_manager, wvmConnect NAME = livetest.PREFIX + "nvram" diff --git a/vrtManager/test_migration.py b/vrtManager/tests/test_migration.py similarity index 100% rename from vrtManager/test_migration.py rename to vrtManager/tests/test_migration.py diff --git a/vrtManager/test_network_ip.py b/vrtManager/tests/test_network_ip.py similarity index 100% rename from vrtManager/test_network_ip.py rename to vrtManager/tests/test_network_ip.py diff --git a/vrtManager/test_persistent_edits.py b/vrtManager/tests/test_persistent_edits.py similarity index 100% rename from vrtManager/test_persistent_edits.py rename to vrtManager/tests/test_persistent_edits.py diff --git a/vrtManager/test_read_cache.py b/vrtManager/tests/test_read_cache.py similarity index 100% rename from vrtManager/test_read_cache.py rename to vrtManager/tests/test_read_cache.py diff --git a/vrtManager/test_remove_nvram.py b/vrtManager/tests/test_remove_nvram.py similarity index 100% rename from vrtManager/test_remove_nvram.py rename to vrtManager/tests/test_remove_nvram.py diff --git a/vrtManager/test_resize_disk.py b/vrtManager/tests/test_resize_disk.py similarity index 100% rename from vrtManager/test_resize_disk.py rename to vrtManager/tests/test_resize_disk.py diff --git a/vrtManager/test_rwlock.py b/vrtManager/tests/test_rwlock.py similarity index 100% rename from vrtManager/test_rwlock.py rename to vrtManager/tests/test_rwlock.py diff --git a/vrtManager/test_usage.py b/vrtManager/tests/test_usage.py similarity index 100% rename from vrtManager/test_usage.py rename to vrtManager/tests/test_usage.py diff --git a/vrtManager/test_util.py b/vrtManager/tests/test_util.py similarity index 100% rename from vrtManager/test_util.py rename to vrtManager/tests/test_util.py diff --git a/vrtManager/test_xml_safety.py b/vrtManager/tests/test_xml_safety.py similarity index 100% rename from vrtManager/test_xml_safety.py rename to vrtManager/tests/test_xml_safety.py diff --git a/vrtManager/test_xpath_values.py b/vrtManager/tests/test_xpath_values.py similarity index 100% rename from vrtManager/test_xpath_values.py rename to vrtManager/tests/test_xpath_values.py diff --git a/webvirtcloud/tests/__init__.py b/webvirtcloud/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/webvirtcloud/js_tests/instance_tabs.test.js b/webvirtcloud/tests/js/instance_tabs.test.js similarity index 100% rename from webvirtcloud/js_tests/instance_tabs.test.js rename to webvirtcloud/tests/js/instance_tabs.test.js diff --git a/webvirtcloud/js_tests/poll.test.js b/webvirtcloud/tests/js/poll.test.js similarity index 98% rename from webvirtcloud/js_tests/poll.test.js rename to webvirtcloud/tests/js/poll.test.js index e49fae0b..147be071 100644 --- a/webvirtcloud/js_tests/poll.test.js +++ b/webvirtcloud/tests/js/poll.test.js @@ -1,5 +1,5 @@ // Behaviour of static/js/poll.js with a fake clock, document and jQuery promise. -// Run by webvirtcloud/test_poll_js.py: node poll.test.js static/js/poll.js +// Run by webvirtcloud/tests/test_poll_js.py: node poll.test.js static/js/poll.js const fs = require("fs"); const assert = require("assert"); diff --git a/webvirtcloud/test_api_schema.py b/webvirtcloud/tests/test_api_schema.py similarity index 100% rename from webvirtcloud/test_api_schema.py rename to webvirtcloud/tests/test_api_schema.py diff --git a/webvirtcloud/test_authorization_matrix.py b/webvirtcloud/tests/test_authorization_matrix.py similarity index 100% rename from webvirtcloud/test_authorization_matrix.py rename to webvirtcloud/tests/test_authorization_matrix.py diff --git a/webvirtcloud/test_child_processes.py b/webvirtcloud/tests/test_child_processes.py similarity index 96% rename from webvirtcloud/test_child_processes.py rename to webvirtcloud/tests/test_child_processes.py index a6dff469..025cfe97 100644 --- a/webvirtcloud/test_child_processes.py +++ b/webvirtcloud/tests/test_child_processes.py @@ -9,7 +9,7 @@ import sys import unittest from pathlib import Path -ROOT = Path(__file__).resolve().parent.parent +ROOT = Path(__file__).resolve().parent.parent.parent CHECK = """ import signal, subprocess diff --git a/webvirtcloud/test_common_tags.py b/webvirtcloud/tests/test_common_tags.py similarity index 100% rename from webvirtcloud/test_common_tags.py rename to webvirtcloud/tests/test_common_tags.py diff --git a/webvirtcloud/test_connection_errors.py b/webvirtcloud/tests/test_connection_errors.py similarity index 100% rename from webvirtcloud/test_connection_errors.py rename to webvirtcloud/tests/test_connection_errors.py diff --git a/webvirtcloud/test_gunicorn_conf.py b/webvirtcloud/tests/test_gunicorn_conf.py similarity index 100% rename from webvirtcloud/test_gunicorn_conf.py rename to webvirtcloud/tests/test_gunicorn_conf.py diff --git a/webvirtcloud/test_icon_cache.py b/webvirtcloud/tests/test_icon_cache.py similarity index 100% rename from webvirtcloud/test_icon_cache.py rename to webvirtcloud/tests/test_icon_cache.py diff --git a/webvirtcloud/test_instance_tabs_js.py b/webvirtcloud/tests/test_instance_tabs_js.py similarity index 91% rename from webvirtcloud/test_instance_tabs_js.py rename to webvirtcloud/tests/test_instance_tabs_js.py index cf1d13d6..0adb596b 100644 --- a/webvirtcloud/test_instance_tabs_js.py +++ b/webvirtcloud/tests/test_instance_tabs_js.py @@ -15,7 +15,7 @@ class InstanceTabsTestCase(unittest.TestCase): @unittest.skipUnless(shutil.which("node"), "node is not installed") def test_instance_tabs_js(self): result = subprocess.run( - ["node", str(BASE / "webvirtcloud/js_tests/instance_tabs.test.js"), str(BASE / "static/js/instance_tabs.js")], + ["node", str(BASE / "webvirtcloud/tests/js/instance_tabs.test.js"), str(BASE / "static/js/instance_tabs.js")], capture_output=True, text=True, timeout=60, diff --git a/webvirtcloud/test_logging.py b/webvirtcloud/tests/test_logging.py similarity index 100% rename from webvirtcloud/test_logging.py rename to webvirtcloud/tests/test_logging.py diff --git a/webvirtcloud/test_otp_bypass.py b/webvirtcloud/tests/test_otp_bypass.py similarity index 100% rename from webvirtcloud/test_otp_bypass.py rename to webvirtcloud/tests/test_otp_bypass.py diff --git a/webvirtcloud/test_poll_js.py b/webvirtcloud/tests/test_poll_js.py similarity index 97% rename from webvirtcloud/test_poll_js.py rename to webvirtcloud/tests/test_poll_js.py index 8bf61298..2678c42a 100644 --- a/webvirtcloud/test_poll_js.py +++ b/webvirtcloud/tests/test_poll_js.py @@ -18,7 +18,7 @@ class PollTestCase(unittest.TestCase): @unittest.skipUnless(shutil.which("node"), "node is not installed") def test_poll_js(self): result = subprocess.run( - ["node", str(BASE / "webvirtcloud/js_tests/poll.test.js"), str(BASE / "static/js/poll.js")], + ["node", str(BASE / "webvirtcloud/tests/js/poll.test.js"), str(BASE / "static/js/poll.js")], capture_output=True, text=True, timeout=60, diff --git a/webvirtcloud/test_settings_env.py b/webvirtcloud/tests/test_settings_env.py similarity index 100% rename from webvirtcloud/test_settings_env.py rename to webvirtcloud/tests/test_settings_env.py diff --git a/webvirtcloud/test_static_files.py b/webvirtcloud/tests/test_static_files.py similarity index 100% rename from webvirtcloud/test_static_files.py rename to webvirtcloud/tests/test_static_files.py