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
1 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

0

Please sign in to leave a comment.