summaryrefslogtreecommitdiff
path: root/odoo/service/server.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2020-07-27 12:09:50 +0000
committerXavier Morel <xmo@odoo.com>2020-08-19 07:28:44 +0000
commitec8a64a85c7ce751bbd4fc3b5a2a8224a84c81d0 (patch)
tree0bc5a7b4668688c2ea7d007137ee2705fce19d82 /odoo/service/server.py
parente46a8bc7d95501569fd95c499b84a7027a3f2831 (diff)
[REF] core: move testing-related functions to odoo/tests submodules
Attempts to clean up odoo/module and odoo/service a tad, they still invoke testing-related utilities but are more logical in what they *contain*.
Diffstat (limited to 'odoo/service/server.py')
-rw-r--r--odoo/service/server.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/odoo/service/server.py b/odoo/service/server.py
index 87e9b8ddf42..3f9d7376901 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -53,11 +53,11 @@ except ImportError:
import odoo
from odoo.modules import get_modules
-from odoo.modules.module import run_unit_tests, get_test_modules
from odoo.modules.registry import Registry
from odoo.release import nt_service_name
from odoo.tools import config
from odoo.tools import stripped_sys_argv, dumpstacks, log_ormcache_stats
+from ..tests import loader, runner
_logger = logging.getLogger(__name__)
@@ -1171,14 +1171,14 @@ def load_test_file_py(registry, test_file):
try:
test_path, _ = os.path.splitext(os.path.abspath(test_file))
for mod in [m for m in get_modules() if '/%s/' % m in test_file]:
- for mod_mod in get_test_modules(mod):
+ for mod_mod in loader.get_test_modules(mod):
mod_path, _ = os.path.splitext(getattr(mod_mod, '__file__', ''))
if test_path == mod_path:
- tests = odoo.modules.module.unwrap_suite(
+ tests = loader.unwrap_suite(
unittest.TestLoader().loadTestsFromModule(mod_mod))
suite = OdooSuite(tests)
_logger.log(logging.INFO, 'running tests %s.', mod_mod.__name__)
- result = odoo.modules.module.OdooTestRunner().run(suite)
+ result = runner.OdooTestRunner().run(suite)
success = result.wasSuccessful()
if hasattr(registry._assertion_report,'report_result'):
registry._assertion_report.report_result(success)
@@ -1219,7 +1219,7 @@ def preload_registries(dbnames):
_logger.info("Starting post tests")
with odoo.api.Environment.manage():
for module_name in module_names:
- result = run_unit_tests(module_name, position='post_install')
+ result = loader.run_unit_tests(module_name, position='post_install')
registry._assertion_report.record_result(result)
_logger.info("All post-tested in %.2fs, %s queries",
time.time() - t0, odoo.sql_db.sql_counter - t0_sql)