mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[IMP] Minimizes memory consumption
Conflicts: report_py3o/models/py3o_report.py
This commit is contained in:
committed by
Elmeri Niemelä
parent
e69592c5f7
commit
714ea78ce8
@@ -5,6 +5,7 @@
|
||||
import mock
|
||||
import os
|
||||
import pkg_resources
|
||||
import tempfile
|
||||
|
||||
from py3o.formats import Formats
|
||||
|
||||
@@ -60,11 +61,17 @@ class TestReportPy3o(TransactionCase):
|
||||
report = self.env.ref("report_py3o.res_users_report_py3o")
|
||||
with mock.patch.object(
|
||||
py3o_report.__class__, '_create_single_report') as patched_pdf:
|
||||
result = tempfile.mktemp('.txt')
|
||||
with open(result, 'w') as fp:
|
||||
fp.write('dummy')
|
||||
patched_pdf.return_value = result
|
||||
# test the call the the create method inside our custom parser
|
||||
report.render_report(self.env.user.ids,
|
||||
report.report_name,
|
||||
{})
|
||||
self.assertEqual(1, patched_pdf.call_count)
|
||||
# generated files no more exists
|
||||
self.assertFalse(os.path.exists(result))
|
||||
res = report.render_report(
|
||||
self.env.user.ids, report.report_name, {})
|
||||
self.assertTrue(res)
|
||||
|
||||
Reference in New Issue
Block a user