1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 11:46:49 +00:00

test: each app keeps its tests in a tests package

131 test modules sat next to the code they test; instances alone had
51 of them beside views.py and utils.py. They move into a
tests/ package per app, and the JavaScript checks into
webvirtcloud/tests/js. Each non-empty tests.py becomes tests/test_views.py;
the empty generated stubs are removed.

Imports of the app's own modules become absolute, paths built from
__file__ go one level up, the live helper is instances.tests.livetest,
and coverage omits */tests/*. The suite discovers the same 960 tests as
before.
This commit is contained in:
catborise 2026-10-12 10:37:29 +03:00
parent 0906838193
commit c55f52f025
154 changed files with 27 additions and 39 deletions

View file

View file

@ -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");

View file

@ -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

View file

@ -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,

View file

@ -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,