From ac9fc496df0985cc82d6bb910fa39b5fc93afa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 28 Jul 2019 16:05:45 +0200 Subject: [PATCH] Convert cache_name by TableHandler when used as database name The name of the cache can be longer than the maximum length of database name. --- trytond/tests/test_tryton.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trytond/tests/test_tryton.py b/trytond/tests/test_tryton.py index a7cb12fe6d..00579edb3d 100644 --- a/trytond/tests/test_tryton.py +++ b/trytond/tests/test_tryton.py @@ -163,6 +163,7 @@ def _pg_restore(cache_file): return not subprocess.call(cmd, env=env) except OSError: cache_name, _ = os.path.splitext(os.path.basename(cache_file)) + cache_name = backend.get('TableHandler').convert_name(cache_name) with Transaction().start( None, 0, close=True, autocommit=True) as transaction: transaction.database.drop(transaction.connection, DB_NAME) @@ -180,6 +181,7 @@ def _pg_dump(cache_file): return not subprocess.call(cmd, env=env) except OSError: cache_name, _ = os.path.splitext(os.path.basename(cache_file)) + cache_name = backend.get('TableHandler').convert_name(cache_name) # Ensure any connection is left open backend.get('Database')(DB_NAME).close() with Transaction().start(