itsulu-blog-publisher/Dockerfile
Nicholas Riegel 6635313f58 port(14.0): fix web_ribbon view attr + convert tests to setUp/self.env
- views/blog_schedule_views.xml: web_ribbon invisible="active" (Odoo 17
  bare-expr syntax) -> attrs="{'invisible': [('active','=',True)]}".
  This was the view-validation error blocking module install on Odoo 14.
- tests: Odoo 14 TransactionCase exposes self.env in setUp(), not cls.env
  in setUpClass() (that pattern is Odoo 15+). Converted all 13 setUpClass
  blocks across 6 test files to setUp(self) + self.env/self.factory.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 11:44:24 -04:00

29 lines
1.2 KiB
Docker

FROM odoo:14.0
# Install Python testing dependencies. odoo:14.0 ships Python 3.7, so pin to
# the last releases that still support 3.7 (pytest 8 / pytest-bdd 7 / pytest-html 4
# all require 3.8+).
RUN python3 -m pip install --no-cache-dir \
"pytest>=7,<8" \
"pytest-odoo<2" \
"pytest-bdd>=6,<7" \
"pytest-cov<5" \
"pytest-html<4" \
requests
# Copy addon to Odoo addons path
RUN mkdir -p /mnt/extra-addons && chmod 777 /mnt/extra-addons
COPY --chown=odoo:odoo addons/itsulu_blog_publisher /mnt/extra-addons/itsulu_blog_publisher
# Copy root conftest.py to parent of addons so pytest-bdd fixtures (odoo_env) are discovered
# when running pytest against /mnt/extra-addons/... (pytest traverses up to find conftest files)
COPY --chown=odoo:odoo conftest.py /mnt/extra-addons/conftest.py
# Symlink addon into Odoo's default addons directory so Odoo can find it
RUN mkdir -p /var/lib/odoo/addons && ln -s /mnt/extra-addons/itsulu_blog_publisher /var/lib/odoo/addons/itsulu_blog_publisher
# Set working directory to a temp location for test running
WORKDIR /tmp/test
# Default command runs tests (can be overridden)
CMD ["python3", "-m", "pytest", "tests/", "-v", "--html=/tmp/report.html", "--self-contained-html"]