Pycharm - docker-compose testing and coverage with a pure python project
For a Django project, I can get coverage and unit tests to run inside the windows provided by PyCharm. However, when working with a pure python project (for a future command line program), I can't seem to get docker-compose to integrate or be recognized by the testing / coverage windows. For example, instead of the test dialog popping up, I have to look at the log in the docker window o see the results.
Does anyone have experience setting up a pure python project with docker-compose as the interpreter? If so, could you share a reproducible example of your Dockerfile + docker-compose and any commands you run to integrate with PyCharm?
This is what I have right now:
Dockerfile:
FROM python:3.6
COPY requirements.txt /
RUN pip install -r /requirements.txt
docker-compose.yml
version: '2'
services:
sut:
build:
context: .
dockerfile: Dockerfile
command: "bash -c 'cd /app && python -m unittest discover'"
volumes:
- .:/app
Please sign in to leave a comment.
Hi Brandon,
I'm not sure why you're facing this problem, but I've tested with docker-compose interpreter and I get the tests and coverage working just fine, here's a screenshot showing both coverage and test windows for a docker-compose project:
Is this what you're trying to achieve? Feel free to take a look at the project sample: http://bit.ly/2RZzPN6
could you please show the test settings? I'm stuck on it too.
Here's some screenshot of tests running successfully in a simple Django project using docker-compose interpreter.
Andrey Resler yes but with coverage? Did you try?
Sure, the test coverage works as well
The settings are the same as previous post.
It's working both using bundled and non-bundled coverage (settings at Preferences | Build, Execution, Deployment | Coverage), in the latter case, you have to install coverage using Dockerfile. Please try it both ways.
Do you have the same settings?
And do you have .coveragerc ? file
and if yes what you put inside?
Yes, same as yours. For me it's working without .coveragerc config.
Here's the project I'm testing with, may be you could try it as well: https://andrey-resler@bitbucket.org/andrey-resler/django_test.git
Just a the Dockerfile and docker-compose.yml and create an interpreter from that.