-
Notifications
You must be signed in to change notification settings - Fork 77
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
If there is any .so
(e.g., _C.so
) file in a package, Pynguin stops generating tests and reports FileNotFoundError: [Errno 2] No such file or directory: '.../_C.py'
#20
Comments
_C.so
) file in a package, Pynguin stops generating tests and reports FileNotFoundError: [Errno 2] No such file or directory: '.../_C.py'.so
(e.g., _C.so
) file in a package, Pynguin stops generating tests and reports FileNotFoundError: [Errno 2] No such file or directory: '.../_C.py'
Hi @mohrez86 , Thank you for your interest in Pynguin and your warm words. And also thank you for reporting this issue. I agree with your observation and the bug location. We have, honestly, never tried Pynguin on a project that uses modules written in C, i.e., compile down to some I'll play around with some native-code projects to maybe find some more problems and provide a fix release in the next couple of days. Edit: Could you maybe provide the command line arguments you are using? Best, |
Thank you for the prompt reply.
Sure. I used Pynguin running the following command:
Regards, |
Looking into this, I have yet another solution for you: The issue is raised by the static constant seeding, which takes constants (i.e., numbers and strings) from the source code and uses them as seeded values for the input generation (this can be beneficial for test generation, as it was shown, e.g., by Fraser and Arcuri in their 2012 paper “The Seed is Strong: Seeding Strategies in Search-Based Software Testing”). You can easily switch this of by adding Anyway, this is a bug that will be fixed in the near future. |
- Refactor the assertion generation. This unifies the `SIMPLE` and the `MUTATION_ANALYSIS` approaches. Furthermore, Pynguin now uses the `MUTATION_ANALYSIS` approach again as the default. - Update the type annotations in Pynguin's code to the simplified, future versions (e.g. instead of `Dict[str, Set[int]]` we can now write `dict[str, set[int]]`) and do not need any imports from Python's `typing` module. - Fix a crash of the seeding when native modules are present. Fixes #20. - Provide a hint in the documentation that PyCharm 2021.3 now integrates `poetry` support, thus no plugin is required for this (and newer) versions (thanks to @labrenz).
I am trying to generate tests for the project torchvision.
After compiling torchvision, a file named
_C.so
is generated inside the package torchvision. Running Pynguin on the compiled project results in the following error:FileNotFoundError: [Errno 2] No such file or directory: '.../_C.py'
.I found a workaround for now (I just need to add an empty file named
_C.py
next to the_C.so
file).I looked into Pynguin's source code. I think the bug is inside the following function:
https://github.com/se2p/pynguin/blob/main/pynguin/analyses/seeding/constantseeding.py#L139, which is:
pynguin/analyses/seeding/constantseeding.py
_find_modules
The problem is that the function
iter_modules
returns.so
files as well as.py
files.If I am right, this function needs to check if the modules returned by
iter_modules
are definitely.py
files and skipped otherwise.This bug (if it is a bug) can be reproduced by simply putting an empty
.so
file in a package and trying to generate tests for the modules inside that package, using Pynguin.PS: awesome tool!
The text was updated successfully, but these errors were encountered: