Hi,
Has anyone had any experience with testing pyramid from within a docker
container so that changes to source code are recognised within the
container. I am experiencing issues with the container failing to recognise
python package.
My pytests and custom library, pyramid_core, are running within a docker
container via docker-compose. The *get_appsettings* line in the code
listing below raises a *pkg_resources.DistributionNotFound *exception.
from pyramid_core import load_environment
def test_loadenvironment(self):
data_file = Path(THIS_DIR, 'testdata', 'development.ini')
appsettings = get_appsettings(str(data_file), name="main")
...
An extract from the docker-compose file is included in the listing below. I
am using volumes so that changes to src and tests on my host machine are
recognised within the docker container:
version: "3.7"
networks:
localnet:
ipam:
config:
- subnet: 172.22.0.0/16
services:
...
core-library:
container_name: service-core-library
image: core-dev
env_file:
- ./config/.core.dev.env
volumes:
- ../src/pyramid_core:/server/src/pyramid_core
- ../tests:/server/tests
networks:
- localnet
The Dockerfile installs dependencies via *pip install -r requirements.txt*,
e.g.
...
pluggy==0.8.0
psycopg2-binary==2.7.6.1
py==1.7.0
pyramid==1.10.1
#-e git+https://oauth2:${TOKEN}@<git url>...@master#egg=pyramid_core
If I uncomment the last line of the requirements.txt file to install my
custom library from VCS as an editable package I then receive the following
error when running the pytests within the container....
py._path.local.LocalPath.ImportMismatchError: ('tests.conftest',
'/server/tests/conftest.py',
local('/server/src/pyramid-core/tests/conftest.py'))
Has anyone managed to successful run pyramid within a docker container so
that changes to the source code on local development machine is reflected
in the container?
Kind Regards
dcs3spp
--
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/e2b5b530-4f92-4df9-a9b6-c53291b3c29f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.