Skip to content

Commit

Permalink
[UPD] enable test that got disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulb authored and fkantelberg committed Feb 14, 2024
1 parent e233347 commit 29ac79d
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 90 deletions.
63 changes: 33 additions & 30 deletions module_auto_update/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ Module Auto Update

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon provides mechanisms to compute sha1 hashes of installed addons,
and save them in the database. It also provides a method that exploits these
mechanisms to update a database by upgrading only the modules for which the
hash has changed since the last successful upgrade.
This addon provides mechanisms to compute sha1 hashes of installed
addons, and save them in the database. It also provides a method that
exploits these mechanisms to update a database by upgrading only the
modules for which the hash has changed since the last successful
upgrade.

**Table of contents**

Expand All @@ -43,39 +44,41 @@ Configuration

This module supports the following system parameters:

* ``module_auto_update.exclude_patterns``: comma-separated list of file
name patterns to ignore when computing addon checksums. Defaults to
``*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*``.
Filename patterns must be compatible with the python ``fnmatch`` function.
- ``module_auto_update.exclude_patterns``: comma-separated list of file
name patterns to ignore when computing addon checksums. Defaults to
``*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*``. Filename
patterns must be compatible with the python ``fnmatch`` function.

In addition to the above pattern, .po files corresponding to languages that
are not installed in the Odoo database are ignored when computing checksums.
In addition to the above pattern, .po files corresponding to languages
that are not installed in the Odoo database are ignored when computing
checksums.

Usage
=====

The main method provided by this module is ``upgrade_changed_checksum``
on ``ir.module.module``. It runs a database upgrade for all installed
modules for which the hash has changed since the last successful
run of this method. On success it saves the hashes in the database.
modules for which the hash has changed since the last successful run of
this method. On success it saves the hashes in the database.

The first time this method is invoked after installing the module, it
runs an upgrade of all modules, because it has not saved the hashes yet.
This is by design, priviledging safety. Should this be an issue,
the method ``_save_installed_checksums`` can be invoked in a situation
where one is sure all modules on disk are installed and up-to-date in the
This is by design, priviledging safety. Should this be an issue, the
method ``_save_installed_checksums`` can be invoked in a situation where
one is sure all modules on disk are installed and up-to-date in the
database.

To invoke the upgrade mechanism, navigate to *Apps* menu and use the
*Auto-Upgrade Modules* button, available only in developer mode. Restarting
the Odoo instance is highly recommended to minify risk of any possible issues.
*Auto-Upgrade Modules* button, available only in developer mode.
Restarting the Odoo instance is highly recommended to minify risk of any
possible issues.

Another easy way to invoke this upgrade mechanism is by issuing the following
in an Odoo shell session:
Another easy way to invoke this upgrade mechanism is by issuing the
following in an Odoo shell session:

.. code-block:: python
.. code:: python
env['ir.module.module'].upgrade_changed_checksum()
env['ir.module.module'].upgrade_changed_checksum()
Bug Tracker
===========
Expand All @@ -91,25 +94,25 @@ Credits
=======

Authors
~~~~~~~
-------

* LasLabs
* Juan José Scarafía
* Tecnativa
* ACSONE SA/NV

Contributors
~~~~~~~~~~~~
------------

* Brent Hughes <[email protected]>
* Juan José Scarafía <[email protected]>
* Jairo Llopis <[email protected]>
* Stéphane Bidoul <[email protected]> (https://acsone.eu)
* Eric Antones <[email protected]>
* Manuel Engel <[email protected]>
- Brent Hughes <[email protected]>
- Juan José Scarafía <[email protected]>
- Jairo Llopis <[email protected]>
- Stéphane Bidoul <[email protected]> (https://acsone.eu)
- Eric Antones <[email protected]>
- Manuel Engel <[email protected]>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand Down
10 changes: 10 additions & 0 deletions module_auto_update/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This module supports the following system parameters:

- `module_auto_update.exclude_patterns`: comma-separated list of file
name patterns to ignore when computing addon checksums. Defaults to
`*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*`. Filename patterns
must be compatible with the python `fnmatch` function.

In addition to the above pattern, .po files corresponding to languages
that are not installed in the Odoo database are ignored when computing
checksums.
9 changes: 0 additions & 9 deletions module_auto_update/readme/CONFIGURE.rst

This file was deleted.

6 changes: 6 additions & 0 deletions module_auto_update/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Brent Hughes \<<[email protected]>\>
- Juan José Scarafía \<<[email protected]>\>
- Jairo Llopis \<<[email protected]>\>
- Stéphane Bidoul \<<[email protected]>\> (<https://acsone.eu>)
- Eric Antones \<<[email protected]>\>
- Manuel Engel \<<[email protected]>\>
6 changes: 0 additions & 6 deletions module_auto_update/readme/CONTRIBUTORS.rst

This file was deleted.

5 changes: 5 additions & 0 deletions module_auto_update/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This addon provides mechanisms to compute sha1 hashes of installed
addons, and save them in the database. It also provides a method that
exploits these mechanisms to update a database by upgrading only the
modules for which the hash has changed since the last successful
upgrade.
4 changes: 0 additions & 4 deletions module_auto_update/readme/DESCRIPTION.rst

This file was deleted.

23 changes: 23 additions & 0 deletions module_auto_update/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The main method provided by this module is `upgrade_changed_checksum` on
`ir.module.module`. It runs a database upgrade for all installed modules
for which the hash has changed since the last successful run of this
method. On success it saves the hashes in the database.

The first time this method is invoked after installing the module, it
runs an upgrade of all modules, because it has not saved the hashes yet.
This is by design, priviledging safety. Should this be an issue, the
method `_save_installed_checksums` can be invoked in a situation where
one is sure all modules on disk are installed and up-to-date in the
database.

To invoke the upgrade mechanism, navigate to *Apps* menu and use the
*Auto-Upgrade Modules* button, available only in developer mode.
Restarting the Odoo instance is highly recommended to minify risk of any
possible issues.

Another easy way to invoke this upgrade mechanism is by issuing the
following in an Odoo shell session:

``` python
env['ir.module.module'].upgrade_changed_checksum()
```
22 changes: 0 additions & 22 deletions module_auto_update/readme/USAGE.rst

This file was deleted.

37 changes: 20 additions & 17 deletions module_auto_update/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,11 @@ <h1 class="title">Module Auto Update</h1>
!! source digest: sha256:d1196ef676fe52e08aa762c32f6f428315f40e98d05bbc21f3a2c07b47719019
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/module_auto_update"><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-module_auto_update"><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&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon provides mechanisms to compute sha1 hashes of installed addons,
and save them in the database. It also provides a method that exploits these
mechanisms to update a database by upgrading only the modules for which the
hash has changed since the last successful upgrade.</p>
<p>This addon provides mechanisms to compute sha1 hashes of installed
addons, and save them in the database. It also provides a method that
exploits these mechanisms to update a database by upgrading only the
modules for which the hash has changed since the last successful
upgrade.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -394,29 +395,31 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ul class="simple">
<li><tt class="docutils literal">module_auto_update.exclude_patterns</tt>: comma-separated list of file
name patterns to ignore when computing addon checksums. Defaults to
<tt class="docutils literal"><span class="pre">*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*</span></tt>.
Filename patterns must be compatible with the python <tt class="docutils literal">fnmatch</tt> function.</li>
<tt class="docutils literal"><span class="pre">*.pyc,*.pyo,i18n/*.pot,i18n_extra/*.pot,static/*</span></tt>. Filename
patterns must be compatible with the python <tt class="docutils literal">fnmatch</tt> function.</li>
</ul>
<p>In addition to the above pattern, .po files corresponding to languages that
are not installed in the Odoo database are ignored when computing checksums.</p>
<p>In addition to the above pattern, .po files corresponding to languages
that are not installed in the Odoo database are ignored when computing
checksums.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>The main method provided by this module is <tt class="docutils literal">upgrade_changed_checksum</tt>
on <tt class="docutils literal">ir.module.module</tt>. It runs a database upgrade for all installed
modules for which the hash has changed since the last successful
run of this method. On success it saves the hashes in the database.</p>
modules for which the hash has changed since the last successful run of
this method. On success it saves the hashes in the database.</p>
<p>The first time this method is invoked after installing the module, it
runs an upgrade of all modules, because it has not saved the hashes yet.
This is by design, priviledging safety. Should this be an issue,
the method <tt class="docutils literal">_save_installed_checksums</tt> can be invoked in a situation
where one is sure all modules on disk are installed and up-to-date in the
This is by design, priviledging safety. Should this be an issue, the
method <tt class="docutils literal">_save_installed_checksums</tt> can be invoked in a situation where
one is sure all modules on disk are installed and up-to-date in the
database.</p>
<p>To invoke the upgrade mechanism, navigate to <em>Apps</em> menu and use the
<em>Auto-Upgrade Modules</em> button, available only in developer mode. Restarting
the Odoo instance is highly recommended to minify risk of any possible issues.</p>
<p>Another easy way to invoke this upgrade mechanism is by issuing the following
in an Odoo shell session:</p>
<em>Auto-Upgrade Modules</em> button, available only in developer mode.
Restarting the Odoo instance is highly recommended to minify risk of any
possible issues.</p>
<p>Another easy way to invoke this upgrade mechanism is by issuing the
following in an Odoo shell session:</p>
<pre class="code python literal-block">
<span class="n">env</span><span class="p">[</span><span class="s1">'ir.module.module'</span><span class="p">]</span><span class="o">.</span><span class="n">upgrade_changed_checksum</span><span class="p">()</span>
</pre>
Expand Down
5 changes: 3 additions & 2 deletions module_auto_update/tests/test_addon_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

import os
import unittest

from odoo.tests import TransactionCase

from .. import addon_hash
from ..models.module import DEFAULT_EXCLUDE_PATTERNS


class TestAddonHash(unittest.TestCase):
class TestAddonHash(TransactionCase):
def setUp(self):
super().setUp()
self.sample_dir = os.path.join(
Expand Down

0 comments on commit 29ac79d

Please sign in to comment.