[BACKPORT] odoo_test_xmlrunner to 16.0
Also implement a better patch and merge test results.pull/3127/head
parent
c69b5d5006
commit
acab0d8c9e
|
@ -7,7 +7,7 @@ Unittest xUnit reports
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:782b2ed22876a72d28e0e67c5ff949d6d104c2da4bd0cf36ca7dbf3597900604
|
!! source digest: sha256:c168ead1259f832fbcdbe238c9bd5a9eb692d3e0c712130ab2103e4a2dcba36b
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||||
|
@ -17,13 +17,13 @@ Unittest xUnit reports
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/server-tools/tree/17.0/odoo_test_xmlrunner
|
:target: https://github.com/OCA/server-tools/tree/16.0/odoo_test_xmlrunner
|
||||||
:alt: OCA/server-tools
|
:alt: OCA/server-tools
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-odoo_test_xmlrunner
|
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-odoo_test_xmlrunner
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -164,7 +164,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20odoo_test_xmlrunner%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20odoo_test_xmlrunner%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -183,6 +183,10 @@ Other credits
|
||||||
|
|
||||||
- Martin Deconinck martin.deconinck@smile.fr
|
- Martin Deconinck martin.deconinck@smile.fr
|
||||||
|
|
||||||
|
- `Akretion <https://akretion.com>`__:
|
||||||
|
|
||||||
|
- Florian Mounier florian.mounier@akretion.com
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@ -196,6 +200,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/odoo_test_xmlrunner>`_ project on GitHub.
|
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/odoo_test_xmlrunner>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Unittest xUnit reports",
|
"name": "Unittest xUnit reports",
|
||||||
"version": "17.0.1.0.0",
|
"version": "16.0.1.0.0",
|
||||||
"depends": ["base"],
|
"depends": ["base"],
|
||||||
"author": "Smile, Odoo Community Association (OCA)",
|
"author": "Smile, Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
|
|
|
@ -1,33 +1,47 @@
|
||||||
import os
|
import os
|
||||||
import threading
|
from unittest.mock import patch
|
||||||
|
|
||||||
import xmlrunner
|
from xmlrunner import XMLTestRunner
|
||||||
|
from xmlrunner.result import _XMLTestResult
|
||||||
|
|
||||||
from odoo.tests import loader as odoo_loader
|
|
||||||
from odoo.tests.result import OdooTestResult
|
from odoo.tests.result import OdooTestResult
|
||||||
|
from odoo.tests.suite import OdooSuite
|
||||||
from odoo.tools import config
|
from odoo.tools import config
|
||||||
|
|
||||||
|
if config["test_enable"]:
|
||||||
|
unpatched_run = OdooSuite.run
|
||||||
|
|
||||||
def new_run_suite(suite, module_name=None):
|
def run(self, result):
|
||||||
# Override : Get and create a config dir
|
# Override : Get and create a config dir
|
||||||
test_result_directory = config.get("test_result_directory", "test_results")
|
test_result_directory = config.get("test_result_directory", "test_results")
|
||||||
# create test result directory if not exists
|
# create test result directory if not exists
|
||||||
if not os.path.exists(test_result_directory):
|
if not os.path.exists(test_result_directory):
|
||||||
os.makedirs(test_result_directory)
|
os.makedirs(test_result_directory)
|
||||||
|
|
||||||
# avoid dependency hell
|
# Suite run method will be called by the XMLTestRunner,
|
||||||
from odoo.modules import module
|
# so we need to run the original run method
|
||||||
|
with patch.object(self, "run", lambda result: unpatched_run(self, result)):
|
||||||
module.current_test = module_name
|
|
||||||
threading.current_thread().testing = True
|
|
||||||
results = OdooTestResult()
|
|
||||||
|
|
||||||
# Override : XMLTestRunner to run the tests and generate XML reports
|
# Override : XMLTestRunner to run the tests and generate XML reports
|
||||||
xmlrunner.XMLTestRunner(output=test_result_directory, verbosity=2).run(suite)
|
results = XMLTestRunner(
|
||||||
|
output=test_result_directory,
|
||||||
|
verbosity=2,
|
||||||
|
).run(self)
|
||||||
|
|
||||||
threading.current_thread().testing = False
|
result.update(results)
|
||||||
module.current_test = None
|
return result
|
||||||
return results
|
|
||||||
|
|
||||||
|
patch("odoo.tests.suite.OdooSuite.run", run).start()
|
||||||
|
|
||||||
odoo_loader.run_suite = new_run_suite
|
unpatched_update = OdooTestResult.update
|
||||||
|
|
||||||
|
def update(self, other):
|
||||||
|
# Adapt _XMLTestResult to OdooTestResult
|
||||||
|
if isinstance(other, _XMLTestResult):
|
||||||
|
self.failures_count += len(other.failures)
|
||||||
|
self.errors_count += len(other.errors)
|
||||||
|
self.skipped += len(other.skipped)
|
||||||
|
self.testsRun += other.testsRun
|
||||||
|
else:
|
||||||
|
unpatched_update(self, other)
|
||||||
|
|
||||||
|
patch("odoo.tests.result.OdooTestResult.update", update).start()
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
* [Smile](https://smile.eu/fr):
|
- [Smile](https://smile.eu/fr):
|
||||||
* Martin Deconinck <martin.deconinck@smile.fr>
|
- Martin Deconinck <martin.deconinck@smile.fr>
|
||||||
|
- [Akretion](https://akretion.com):
|
||||||
|
- Florian Mounier <florian.mounier@akretion.com>
|
||||||
|
|
|
@ -8,10 +8,11 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
:Author: David Goodger (goodger@python.org)
|
:Author: David Goodger (goodger@python.org)
|
||||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||||
:Copyright: This stylesheet has been placed in the public domain.
|
:Copyright: This stylesheet has been placed in the public domain.
|
||||||
|
|
||||||
Default cascading style sheet for the HTML output of Docutils.
|
Default cascading style sheet for the HTML output of Docutils.
|
||||||
|
Despite the name, some widely supported CSS2 features are used.
|
||||||
|
|
||||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||||
customize this style sheet.
|
customize this style sheet.
|
||||||
|
@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||||
margin-left: 2em ;
|
margin-left: 2em ;
|
||||||
margin-right: 2em }
|
margin-right: 2em }
|
||||||
|
|
||||||
pre.code .ln { color: grey; } /* line numbers */
|
pre.code .ln { color: gray; } /* line numbers */
|
||||||
pre.code, code { background-color: #eeeeee }
|
pre.code, code { background-color: #eeeeee }
|
||||||
pre.code .comment, code .comment { color: #5C6576 }
|
pre.code .comment, code .comment { color: #5C6576 }
|
||||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||||
|
@ -300,7 +301,7 @@ span.option {
|
||||||
span.pre {
|
span.pre {
|
||||||
white-space: pre }
|
white-space: pre }
|
||||||
|
|
||||||
span.problematic {
|
span.problematic, pre.problematic {
|
||||||
color: red }
|
color: red }
|
||||||
|
|
||||||
span.section-subtitle {
|
span.section-subtitle {
|
||||||
|
@ -366,9 +367,9 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:782b2ed22876a72d28e0e67c5ff949d6d104c2da4bd0cf36ca7dbf3597900604
|
!! source digest: sha256:c168ead1259f832fbcdbe238c9bd5a9eb692d3e0c712130ab2103e4a2dcba36b
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/odoo_test_xmlrunner"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-odoo_test_xmlrunner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/odoo_test_xmlrunner"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-odoo_test_xmlrunner"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module generate unittest reports using unittest-xml-reporting tool.</p>
|
<p>This module generate unittest reports using unittest-xml-reporting tool.</p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
|
@ -511,7 +512,7 @@ for more information.</p>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20odoo_test_xmlrunner%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20odoo_test_xmlrunner%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -529,16 +530,22 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||||
<li>Martin Deconinck <a class="reference external" href="mailto:martin.deconinck@smile.fr">martin.deconinck@smile.fr</a></li>
|
<li>Martin Deconinck <a class="reference external" href="mailto:martin.deconinck@smile.fr">martin.deconinck@smile.fr</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference external" href="https://akretion.com">Akretion</a>:<ul>
|
||||||
|
<li>Florian Mounier <a class="reference external" href="mailto:florian.mounier@akretion.com">florian.mounier@akretion.com</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
<h2><a class="toc-backref" href="#toc-entry-10">Maintainers</a></h2>
|
<h2><a class="toc-backref" href="#toc-entry-10">Maintainers</a></h2>
|
||||||
<p>This module is maintained by the OCA.</p>
|
<p>This module is maintained by the OCA.</p>
|
||||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||||
|
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||||
|
</a>
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/17.0/odoo_test_xmlrunner">OCA/server-tools</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/odoo_test_xmlrunner">OCA/server-tools</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../odoo_test_xmlrunner
|
|
@ -0,0 +1,6 @@
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
Loading…
Reference in New Issue