se2p / pynguin

The PYthoN General UnIt Test geNerator is a test-generation tool for Python
https://www.pynguin.eu
MIT License
1.24k stars 75 forks source link

Docker build issues #19

Closed MBA76 closed 2 years ago

MBA76 commented 2 years ago

Hi,

I want use pynguin as a docker container. I tried to build the dockerfile which is in the repository.("docker build --tag pynguin .") but is did not build. The reason; Errors related to "poetry"..

image

image

image

I copied pymyproject.toml, README.md and pynguin folder whic is in the repo to the dokcer folder. After; i tryed build ,and builded successfull. I tryed docker run with volumes parameters. The container gave the following as output image

where is the i do mistakes, can your help me?.

stephanlukasczyk commented 2 years ago

I am not sure about the exact reason—I am by far no Docker expert. I assume this might be related to the fact that the Dockerfile is stored in the docker directory. If I run

docker build --tag pynguin . -f ./docker/Dockerfile

Docker builds the container as expected, so there is no need to copy around files. To execute the container then, I used the following command line (with line-breaks for better readability):

docker run \
    -v /path/to/checkout/of/pynguin/docs/source/_static:/input:ro \
    -v /tmp:/output \
    -v /tmp:/package:ro \
    pynguin \
        --project-path /input \
        --output-path /output \
        --module-name example \
        -v

Please note that I bind the /output directory of the container to /tmp, which works on Linux/macOS, but might not work on Windows. Please further note, that the Pynguin Docker container expects a directory that contains a file package.txt to be mounted to /package (the third -v option). For this example, the file can be empty (I just did touch /tmp/package.txt); if the module you want to generate requires some dependencies it is necessary to specify those in the package.txt file (it will be used by pip install -r /package/package.txt inside the container).

The other options I am using above are taken from the quickstart guide.