"'dcs3spp' via pylons-discuss"
<[email protected]> writes:

> Has anyone had any experience with testing pyramid from within a docker 
> container so that changes to source code are recognised within the 
> container.

Yes, I do that very often: basically I install all project modules in
edit-mode inside the image, and override their sources with explicit volumes
when I run the tests.

What works for me is more or less:

- my Dockerfile.tests does something like::

   WORKDIR /srv

   ENTRYPOINT ["python3", "-m", "pytest", "-p", "no:cacheprovider"]

   COPY constraints.txt /tmp/constraints.txt
   COPY app/requirements.txt /tmp/app-reqs.txt
   COPY model/requirements.txt /tmp/model-reqs.txt
   COPY tests/requirements.txt /tmp/tests-reqs.txt
   
   RUN pip install --no-cache \
           -c /tmp/constraints.txt \
           -r /tmp/app-reqs.txt \
           -r /tmp/model-reqs.txt \
           -r /tmp/tests-reqs.txt \
       && rm -f /tmp/*-reqs.txt /tmp/constraints.txt

   COPY app /usr/src/app
   COPY model /usr/src/model

   RUN pip install --no-cache \
           -e /usr/src/app \
           -e /usr/src/model

- my docker-compose.yml has a "tests" service like the following::

   tests:
     build:
       context: .
       dockerfile: Dockerfile.tests
     volumes:
       - "./app/tests:/srv/app"
       - "./app:/usr/src/app"
       - "./lib/model/tests:/srv/model"
       - "./lib/model:/usr/src/model"

Hope this helps,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
[email protected]  |                 -- Fortunato Depero, 1929.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/87va1ej49k.fsf%40metapensiero.it.
For more options, visit https://groups.google.com/d/optout.

Reply via email to