Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][OU-ADD] enable tests, add decorator to make them convenient to use #4672

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/documentation-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,14 +131,16 @@ 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 \
--db_password=$DB_PASSWORD \
--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 \
Expand Down
17 changes: 17 additions & 0 deletions openupgrade_framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading