Thanks Lele, much appreciated.
Yes, your response has helped a lot and confirms it is possible. I like the
use of no:cacheprovider and will add that to my Dockerfile to save a lot of
headaches, see below...
Based on your response it seems that I am almost there...
I have been installing my source library dependencies in edit mode by
including a link to repositories in requirements.txt, e.g. -e
git+https://<url>.....
When I do this, it causes the following error:
*py._path.local.LocalPath.ImportMismatchError: ('tests.conftest',
'/server/tests/conftest.py',
local('/server/src/pyramid-core/tests/conftest.py'))*
My package has the name pyramid_core. It looks as though pip is
automatically converting the underscore character to a hyphen.
After some googling, this error can be caused by pycache files....
Will try and experiment with installing editable packages with pip install
-e .....
Apologies for another question, but does your requirements.txt files
contain the same dependencies as your setup.py files?
Again, much appreciated, this has been really helpful :)
Kind Regards
dcs3spp
On Wednesday, 20 February 2019 07:41:38 UTC, Lele Gaifax wrote:
>
> "'dcs3spp' via pylons-discuss"
> <[email protected] <javascript:>> 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] <javascript:> | -- 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/2c3a29ae-4a1d-4499-8fe1-235eeeea0fb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.