Running pytest on existing docker container


Python Django project, using docker-compose to describe various depending services (like RabbitMQ, etc.)
I'm using Intellij IDEA Ultimate 2017.2 with the python plugin.

To run tests, I have one working configuration: I created a remote docker-compose Python SDK, with a corresponding run configuration.
The problem is that whenever I'm running tests, IDEA first shows a window "docker-compose up", and apparently creates the corresponding container. This is slow.

To make it faster, I'd like to just run docker-compose up myself (I could do it in a terminal, for example), and configure IDEA to run the tests on the already running container.
To do this, I created a new remote docker Python SDK, with a corresponding run configuration.
When I try to execute the tests, the following problem is printed:


8384bd3d19a7:python -u /opt/.pycharm_helpers/pycharm/
Testing started at 11:29 ...
Traceback (most recent call last):
File "/opt/.pycharm_helpers/pycharm/", line 5, in <module>
import pytest
ModuleNotFoundError: No module named 'pytest'

Apparently, python doesn't recognize the pytest module, which is in requirements-dev.txt, and installed in the Dockerfile. When looking at the SDK settings for the remote docker, under "packages", I indeed cannot see pytest. (In the working remote docker-compose SDK, I do see pytest.)

Does somebody know what's going on, and how I could fix this?

Thanks in advance!

Please sign in to leave a comment.