diff --git a/.github/workflows/documentation-commit.yml b/.github/workflows/documentation-commit.yml index 7438211c4abc..32c37e813fd7 100644 --- a/.github/workflows/documentation-commit.yml +++ b/.github/workflows/documentation-commit.yml @@ -52,6 +52,7 @@ jobs: unixodbc-dev - name: Requirements Installation run: | + sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version == '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version == '3.10')/\12.0.2\2/" odoo/requirements.txt pip install -q -r odoo/requirements.txt pip install -r ./requirements.txt - name: OpenUpgrade Docs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 097177f1e859..fabd102eaaa5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,15 +85,17 @@ jobs: unixodbc-dev - name: Requirements Installation run: | + sed -i -E "s/(gevent==)21\.8\.0( ; sys_platform != 'win32' and python_version == '3.10')/\122.10.2\2/;s/(greenlet==)1.1.2( ; sys_platform != 'win32' and python_version == '3.10')/\12.0.2\2/" odoo/requirements.txt pip install -q -r odoo/requirements.txt pip install -r ./openupgrade/requirements.txt # this is for v15 l10n_eg_edi_eta which crashes without it pip install asn1crypto - name: Test data run: | - for snippet in openupgrade/openupgrade_scripts/scripts/*/*/tests/data*.py; do - odoo-old/odoo-bin shell -d $DB < $snippet - done + if test -n "$(ls openupgrade/openupgrade_scripts/scripts/*/tests/data*.py 2> /dev/null)"; then + for snippet in openupgrade/openupgrade_scripts/scripts/*/tests/data*.py; do + odoo-old/odoo-bin shell -d $DB < $snippet + done - name: OpenUpgrade test run: | # select modules and perform the upgrade @@ -129,7 +131,7 @@ jobs: echo Execution of Openupgrade with the update of the following modules : $MODULES_NEW # Silence redundant logs from unlinking records (1 line is enough) # to prevent log overflow - OPENUPGRADE_TESTS=1 $ODOO \ + $ODOO \ --addons-path=`echo $ADDONS_PATHS | awk -v OFS="," '$1=$1'` \ --database=$DB \ --db_host=$DB_HOST \ @@ -137,6 +139,8 @@ jobs: --db_port=$DB_PORT \ --db_user=$DB_USERNAME \ --load=base,web,openupgrade_framework \ + --test-enable \ + --test-tags openupgrade \ --log-handler odoo.models.unlink:WARNING \ --test-enable \ --stop-after-init \ diff --git a/openupgrade_framework/__init__.py b/openupgrade_framework/__init__.py index e3b93cdf5f45..2aee639f0d3d 100644 --- a/openupgrade_framework/__init__.py +++ b/openupgrade_framework/__init__.py @@ -14,3 +14,20 @@ "location of openupgrade_scripts" ) config["upgrade_path"] = os.path.join(path, "scripts") + + +def openupgrade_test(cls): + """ + Set attributes on a test class necessary for the test framework + Use as decorator on test classes in openupgrade_scripts/scripts/*/tests/test_*.py + """ + tags = getattr(cls, "test_tags", None) or set() + if "openupgrade" not in tags: + tags.add("openupgrade") + if not any(t.endswith("_install") for t in tags): + tags.add("at_install") + cls.test_tags = tags + cls.test_module = cls.__module__.split(".")[2] + cls.test_class = cls.__name__ + cls.test_sequence = 0 + return cls