Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pynguin seems not work on arrow project #83

Open
denini08 opened this issue Dec 13, 2024 · 1 comment
Open

pynguin seems not work on arrow project #83

denini08 opened this issue Dec 13, 2024 · 1 comment

Comments

@denini08
Copy link

denini08 commented Dec 13, 2024

Describe the bug

Im trying to use pynguing to run on the arrow project, but it doesn't seem to work. Could you tell me if I'm doing something wrong or is it a bug in Pynguin?

To Reproduce

I used docker for reproducibility:

1. run docker

docker run -it --rm python:3.10.14-slim-bullseye bash

2. install git

apt update && apt install -y git

3. clone the repo

git clone --depth=1 https://github.com/arrow-py/arrow
cd arrow

4. install the dependencies

pip3 install --upgrade pip setuptools wheel
pip3 install .[dev,test,tests,testing]
# Install additional requirements if available (within root + 2 nest levels excluding env/ folder)
find . -maxdepth 3 -type d -name "env" -prune -o -type f -name "*.txt" -print | while read -r file; do
    if [ -f "$file" ]; then
        pip3 install -r "$file"
    fi
done
pip3 install pytest pynguin

5. run the test generator

export PYNGUIN_DANGER_AWARE=true
pynguin -v --project-path . --output-path ./tests2 --module-name arrow.arrow

Screenshots
image

image

Software Version:

  • OS: docker with python:3.10.14-slim-bullseye
  • Python version 3.10.14
  • Pynguin Version 0.40.0

additional information
I plan to use Pynguin to create tests in several repositories that I am studying

@stephanlukasczyk
Copy link
Member

stephanlukasczyk commented Jan 14, 2025

Dear @denini08

Please excuse my late reply, I've totally missed the notification for your issue.

First, thank you for your interest in Pynguin and the report.

I have good and bad news: the bad news is that we see this issue in the execution every now and then. The problem is that the execution of a generated test is isolated in a separate thread, which for some reason could not be terminated correctly. Worse, it did not even return an execution result. We still have not fully understood why this happens and what the underlying module's properties cause it. Thus, we unfortunately have no real solution for this.

The good news is that @BergLucas is working on this issue and has some solution. You can try this out by using https://github.com/BergLucas/pynguin/tree/improvement/subprocess-execution instead of upstream Pynguin. Instead of installing Pynguin into your Docker container (step 4 of your report), do the following:

pip install poetry
git clone https://github.com/BergLucas/pynguin /pynguin
cd pynguin
git checkout improvement/subprocess-execution
poetry build
pip install dist/pynguin-0.41.0.dev0-py3-none-any.whl

To execute Pynguin, add --subprocess to its command line (step 5):

pynguin -v --project-path . --output-path ./tests2 --module-name arrow.arrow --subprocess

With this approach I was able to generate tests. But there's a caveat of the approach: it is slower than Pynguin's thread-based execution, which means that you have to wait longer for a result. I am discussing this with @BergLucas , what we can do about speed and also about integrating the approach into Pynguin's main repository. For now, you could try it out such that you can continue with your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants