From 24ff6d033bfd4ef7556b8dcb0d460b30969faf99 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 16 Sep 2010 16:46:44 +0200 Subject: [PATCH] [IMP] yaml_import: enforce ISO date format for date[time] fields in yml tests, to execute locale-agnostic tests bzr revid: odo@openerp.com-20100916144644-thsb8624du8ik6rn --- bin/tools/yaml_import.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 87fd2ff432c..b307eb93ef1 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -374,6 +374,14 @@ class YamlInterpreter(object): elif column._type == "many2many": ids = [self.get_id(xml_id) for xml_id in expression] value = [(6, 0, ids)] + elif column._type == "date": + # enforce ISO format for date values, to be locale-agnostic during tests + time.strptime(expression, "%Y-%m-%d") + value = expression + elif column._type == "datetime": + # enforce ISO format for date values, to be locale-agnostic during tests + time.strptime(expression, "%Y-%m-%d %H:%M:%S") + value = expression else: # scalar field if is_eval(expression): value = self.process_eval(expression)