changeset 8cd6dd7196eb in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=8cd6dd7196eb
description:
        Create record by XML for test with readonly transaction

        issue10936
diffstat:

 trytond/tests/field_function.xml     |  9 +++++++++
 trytond/tests/test_field_function.py |  3 +--
 trytond/tests/tryton.cfg             |  1 +
 3 files changed, 11 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 892358d75f69 -r 8cd6dd7196eb trytond/tests/field_function.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/trytond/tests/field_function.xml  Sun Nov 28 14:31:45 2021 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<tryton>
+    <data>
+        <record model="test.function.getter_context" 
id="field_function_getter_context">
+        </record>
+    </data>
+</tryton>
diff -r 892358d75f69 -r 8cd6dd7196eb trytond/tests/test_field_function.py
--- a/trytond/tests/test_field_function.py      Sun Nov 28 13:45:54 2021 +0100
+++ b/trytond/tests/test_field_function.py      Sun Nov 28 14:31:45 2021 +0100
@@ -52,8 +52,7 @@
 
         with Transaction().new_transaction(readonly=True), \
                 patch.object(Model, 'getter') as getter:
-            record = Model()
-            record.save()
+            record, = Model.search([], limit=1)
             record.function_with_context
             record.function_without_context
             self.assertEqual(getter.call_count, 2)
diff -r 892358d75f69 -r 8cd6dd7196eb trytond/tests/tryton.cfg
--- a/trytond/tests/tryton.cfg  Sun Nov 28 13:45:54 2021 +0100
+++ b/trytond/tests/tryton.cfg  Sun Nov 28 14:31:45 2021 +0100
@@ -8,4 +8,5 @@
     workflow.xml
     wizard.xml
     modelview.xml
+    field_function.xml
     message.xml

Reply via email to