From 63c00f700da8d1c59d61d79556de2b9cd0acf564 Mon Sep 17 00:00:00 2001 From: John Wilson Date: Wed, 28 Jul 2021 19:59:10 +0000 Subject: [PATCH] [FIX] various: --test-file on Windows closes odoo/odoo#75341 Signed-off-by: Xavier Morel (xmo) --- odoo/service/server.py | 2 +- odoo/tools/config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/odoo/service/server.py b/odoo/service/server.py index 5612af5bf52..961199b7c62 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -1220,7 +1220,7 @@ def load_test_file_py(registry, test_file): threading.currentThread().testing = True 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 in [m for m in get_modules() if '%s%s%s' % (os.path.sep, m, os.path.sep) in test_file]: for mod_mod in loader.get_test_modules(mod): mod_path, _ = os.path.splitext(getattr(mod_mod, '__file__', '')) if test_path == config._normalize(mod_path): diff --git a/odoo/tools/config.py b/odoo/tools/config.py index e2f4ebd195e..7c320372158 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -10,7 +10,7 @@ import sys import tempfile import warnings import odoo -from os.path import expandvars, expanduser, abspath, realpath +from os.path import expandvars, expanduser, abspath, realpath, normcase from .. import release, conf, loglevels from . import appdirs @@ -737,7 +737,7 @@ class configmanager(object): def _normalize(self, path): if not path: return '' - return realpath(abspath(expanduser(expandvars(path.strip())))) + return normcase(realpath(abspath(expanduser(expandvars(path.strip()))))) config = configmanager()