se2p / pynguin

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

The --maximum_iteration flag doesn't actually do anything #33

Closed angelomorgado closed 1 year ago

angelomorgado commented 1 year ago

I was trying to limit the time waiting for the generation of the test cases, and for that I used the flag. Nonetheless, the flag didn't limit the number of iterations of the program.

Wooza commented 1 year ago

I just tested this on git tag 0.27.0 and still seems to work for me, i.e., I get the following (truncated) output

[17:14:34] [INFO](pynguin.generator:_run:507): Start generating test cases
[17:14:35] [INFO](pynguin.generation.searchobserver:before_first_search_iteration:66): Initial Population, Coverage: 0.750000
[17:14:35] [INFO](pynguin.generation.searchobserver:after_search_iteration:70): Iteration:       1, Coverage: 0.750000
[17:14:35] [INFO](pynguin.generator:_run:512): Stopping condition reached
[17:14:35] [INFO](pynguin.generator:_run:514): Used iterations: 1/1
[17:14:35] [INFO](pynguin.generator:_run:515): Stop generating test cases

when I specify --maximum_iterations 1 . Can you verify that you are using the most recent version of Pynguin?

angelomorgado commented 1 year ago

Thanks for the quick reply. I think the main problem in question is that i installed it in Ubuntu and the version that pip gets from it is the 0.17 version. I also noticed that in this version there is no such thing as --maximum-search-time, and, instead, there's the flag --stopping_condition MAX_ITERATIONS which fixes it.

TLDR: The problem was that when installing from pip in Ubuntu i can only get version 0.17 instead of 0.27.

stephanlukasczyk commented 1 year ago

I don't know about Ubuntu and its software versions but I suspect that your Ubuntu provides Python 3.8 or 3.9. Pynguin 0.17 was the last version supporting these Python versions, we dropped the support in favour of only supporting Python 3.10 with Pynguin 0.18.0. If your Ubuntu only provides Python < 3.10, pip won't be able to install a more recent version of Pynguin.

You might want to consider using Pynguin in a Docker container, which would allow you to use more recent versions. Alternatively, may I suggest to consider using pyenv to install various versions of Python easily?

angelomorgado commented 1 year ago

Yes, thank you! My Ubuntu is using python 3.8. Fixed the issue, thank you very much!