Releases: se2p/pynguin
Pynguin 0.23.0
-
Provide a naive inheritance graph to improve input generation.
-
Improve killing of long-running test-case executions
-
Add computation of mutation scores for
MUTATION_ANALYSIS
assertion generation.The output variables
NumberOfCreatedMutants
,NumberOfKilledMutants
,NumberOfTimedOutMutants
, andMutationScore
allow to export those values. -
Do not enable
typing.TYPE_CHECKING
for SUT analysis as this may cause circular imports. -
Improve the black list of modules that shall not be incorporated into the test cluster.
-
Annotate failing tests with
@pytest.mark.xfail(strict=True)
. -
Improve log output of mutation-based assertion generation.
-
Add instrumentation to mutated modules to easier kill them.
This change is relevant only to the
MUTATION_ANALYSIS
assertion-generation strategy. -
Write errors in execution threads to the log instead of STDERR to avoid cluttering log output.
-
Add limits for amount and size of constants in the constant pool.
The configuration options
max_dynamic_length
andmax_dynamic_pool_size
allow to set sizes for the maximum length of strings/bytes that shall be stored in the dynamic constant pool and the maximum numbers of constants of a type, respectively. This prevents the constant pool from growing unreasonably large. -
Improve handling of type annotations.
-
Fix computation of cyclomatic complexity.
Computing cyclomatic complexity does not work for functions that are not present in the AST, e.g., default constructors. We now omit those from the computation of the cyclomatic-complexity output variables.
Pynguin 0.22.0
-
Fix selection of type-inference strategy.
-
Fix a bug in the type inference regarding cases where not type information is present.
-
Add a PyLint checker for calls to
print()
. -
Extend the blacklist of modules that shall not be analysed.
-
Raise
RuntimeError
from tracer when called from another thread. -
Provide better exception messages for critical failures.
-
Apply a further limit to the execution time of a single generated test case to at
most 10 seconds. -
Exclude empty enum classes from test cluster to fix test generation.
Parsing included modules raised an issue when the
enum
module is used: the test
cluster then had a reference to theenum.Enum
class, which obviously does not
contain any fields. In the following, generating tests failed, as soon as this
class was selected to fulfil parameter values because there was no field to select
from, e.g.,MyEnum.MY_FIELD
. We now exclude empty enums from the test cluster.
Pynguin 0.21.0
-
Fix a bug in the module analysis regarding nested functions
Nested functions/closures caused Pynguin's module analysis to crash with an
failing assertion. -
Improve the branch-distance computation for
bool
values -
Allow for more statistics variables regarding number of lines and cyclomatic
complexity
Pynguin 0.20.1
- Fix a bug in terminating Pynguin due to threading
Pynguin 0.20.0
Breaking Changes
-
Remove splitting into passing and failing test suite.
Previously, we consider a test case passing if it did not raise any exception
during its execution; it was considered failing otherwise. Pynguin did a split of
the test cases into two test suites before exporting them. This was mainly an
artefact from implementing the random algorithm in the very beginning of the
project. Due to the improved assertion export for exception assertions we can now
get rid of the split and export only one test module containing all generated test
cases. -
Remove the option to use a log file (
--log_file
or--log-file
).Pynguin writes its output to STDOUT/STDERR now, if requested by the
-v
/-vv
switch.
This output is formatted by @willmcgugan's amazing
rich library. A user can disable the output
formatting by setting the--no-rich
flag. Of course, because we believe thatrich
is such an awesome library, we also provide an alias for this flag, called--poor
😉
Further Changes
-
Distinguish between expected and unexpected exceptions.
We consider an exception to be expected if it is explicitly raised in the code
under test or is documented in the code's docstring. For those exceptions we
build anwith pytest.raises
block around the exception-raising statement. All
other exceptions are considered to be unexpected. We decorate the test method
with the@pytest.mark.xfail
decorator and let the exception happen. It is up to
the user to decide whether such an exception is expected. An exception here is
theAssertionError
: it is considered to be expected as soon as there is an
assert
statement in the code under test. -
Improve installation description to explicitly point to using a virtual environment
(see GitHub issue #23, thanks to @tuckcodes). -
Improve variable names and exception assertions
The assertion generation got an improved handling for asserting on exceptions,
which creates more meaningful and (hopefully) better understandable assertions for
exceptions. -
Enhance the module analysis
This is basically a rewrite of our previously existing test cluster, which keeps
track of all the callables from the subject under test as well as the subject's
dependencies. It also incorporates an analysis of the subject's AST (if present)
and allows for more and more precise information about the subject which can then
improve the quality of the generated tests. -
To distinguish bytecode instructions during instrumentation we add an
ArtificialInstr
for our own added instructions. -
Fix a bug in the tracing of runtime types.
During assertion generation Pynguin tracks the variable types to decide for which
values it actually is able to generate assertions. Creating an assertion on a
generator function does not work, as the type is not exposed by Python but only
present during runtime—thus generating an object of this type always fail. We
mitigate this by ignoring objects of typebuiltins.generator
from the assertion
generation. -
Improve documentation regarding coverage measurement and the coverage report
Pynguin 0.19.0
Breaking Change
-
One can now use multiple stopping conditions at a time.
This breaks the CLI in two ways:
- The parameter
--stopping-condition
has been removed. - The parameter
--budget
was renamed to--maximum-search-time
.
Users have to change their run configurations accordingly!
To specify stopping conditions, add one or many from
--maximum-search-time
,--maximum-test-executions
,--maximum-statement-executions
, and--maximum-iterations
to your command line. - The parameter
Further Changes
- Clarify log output for search phases
- Pynguin now uses the
ast.unparse
function from Python's AST library instead of the third-partyastor
library to generate the source code of the test cases.
Pynguin 0.18.0
Breaking Change
-
We drop the support for Python 3.8 and Python 3.9 with this version!
You need Python 3.10 to run Pynguin! We recommend using our Docker container,
which is already based on Python 3.10, to run Pynguin.
Further Changes
- Add line coverage visualisation to the coverage report.
- Add a citation reference to our freshly accepted ICSE'22 tool demo paper “Pynguin:
Automated Unit Test Generation for Python. - Unify the modules for the analysis of the module under test.
Pynguin v0.17.0
- Add line coverage as another coverage type (thanks to @labrenz).
The user can now choose between using either line or branch coverage or both by setting the parameter--coverage-metrics
toLINE
,BRANCH
, orLINE,BRANCH
.
Default value isBRANCH
.
Pynguin v0.16.1
- Update
CITATION.cff
information
Pynguin v0.16.0
- 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 ofDict[str, Set[int]]
we can now writedict[str, set[int]]
) and do
not need any imports from Python'styping
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).