itsulu-blog-publisher/Dockerfile
Nicholas Riegel 58b9fdc097 fix: copy root conftest.py into image and harden email template tests
- Add COPY conftest.py to Dockerfile so the odoo_env fixture is
  available when pytest runs from /tmp/test (the WORKDIR)
- Rewrite 3 email template tests to use template.generate_email()
  instead of querying mail.mail directly — generate_email() is
  synchronous and reliable; mail.mail.subject rendering and res_id
  are not guaranteed in Odoo 17 TransactionCase tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 02:39:38 -04:00

26 lines
976 B
Docker

FROM odoo:17.0
# Install Python testing dependencies using the system Python
RUN python3 -m pip install --no-cache-dir \
pytest \
pytest-odoo \
pytest-bdd \
pytest-cov \
pytest-html \
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 so pytest-bdd fixtures (odoo_env) are available at runtime
COPY --chown=odoo:odoo conftest.py /tmp/test/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"]