Pynguin find classes that are not part of production code
darioamorosodaragona-tuni opened this issue · comments
Describe the bug
I'm using Pynguin to generate test cases for a Python script. The script does not contain classes, but only functions (14 functions).
But when i use Pynguin it finds more than 600 classes and the generation of test cases takes a lot of time.
To Reproduce
Steps to reproduce the behavior:
-
Use the latest Pynguin version
-
Use the following command line arguments to Pynguin:
pynguin --project-path ./coupling --output-path ./tests/developer_coupling/ --module-name developer_coupling -v
[13:12:03] INFO Start Pynguin Test Generation… generator.py:107
INFO Collecting static constants from module under test generator.py:208
INFO No constants found generator.py:211
INFO Setting up runtime collection of constants generator.py:220
[13:12:09] INFO Analyzed project to create test cluster module.py:1318
INFO Modules: 49 module.py:1319
INFO Functions: 109 module.py:1320
INFO Classes: 166 module.py:1321
Expected behavior
I expect that only the classes and functions on my script will be tested.
Software Version (please complete the following information):
- OS: macOS
- Python version Python 3.10
- Pynguin Version latest
Hi,
If I am not mistaken, Pynguin checks all dependencies from the imports of your code recursively, meaning that it will analyze packages that are not explicitly declared in your module, just because they were imported. Usually, many projects rely on objects from their dependencies.
It is hard to tell by just looking at the first lines of Pynguin's logging, but, did you import anything that might have too many interprocedural calls? Also, I am not sure if you mean that the test generation takes too much time, because of each iteration, because of the initial Test Cluster generation, or because of the whole process. Did you try setting the argument --maximum_search_time
to a low value?
Best wishes