|
82 | 82 | from pynguin.utils.exceptions import ( |
83 | 83 | ConstraintValidationError, |
84 | 84 | ConstructionFailedException, |
85 | | - CoroutineFoundException, |
86 | 85 | ) |
87 | 86 | from pynguin.utils.generic.genericaccessibleobject import ( |
88 | 87 | GenericAccessibleObject, |
@@ -1407,10 +1406,16 @@ def __analyse_function( |
1407 | 1406 | LOGGER.debug("Skipping function %s from analysis", func_name) |
1408 | 1407 | return |
1409 | 1408 | if inspect.iscoroutinefunction(func) or inspect.isasyncgenfunction(func): |
| 1409 | + # Pynguin cannot execute coroutines (see issue #62 / MR !59), so we skip |
| 1410 | + # them instead of aborting the whole module and still test its |
| 1411 | + # synchronous members. |
1410 | 1412 | if add_to_test: |
1411 | | - raise CoroutineFoundException("Found coroutine in SUT: %s", func_name) |
1412 | | - # Coroutine outside the SUT are not problematic, just exclude them. |
1413 | | - LOGGER.debug("Skipping coroutine %s outside of SUT", func_name) |
| 1413 | + LOGGER.warning( |
| 1414 | + "Skipping coroutine %s: Pynguin only tests the non-async parts of this module.", |
| 1415 | + func_name, |
| 1416 | + ) |
| 1417 | + else: |
| 1418 | + LOGGER.debug("Skipping coroutine %s outside of SUT", func_name) |
1414 | 1419 | return |
1415 | 1420 |
|
1416 | 1421 | LOGGER.debug("Analysing function %s", func_name) |
@@ -1610,10 +1615,16 @@ def __analyse_method( |
1610 | 1615 | LOGGER.debug("Skipping method %s from analysis", method_name) |
1611 | 1616 | return |
1612 | 1617 | if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(method): |
| 1618 | + # Pynguin cannot execute coroutines (see issue #62 / MR !59), so we skip |
| 1619 | + # them instead of aborting the whole module and still test its |
| 1620 | + # synchronous members. |
1613 | 1621 | if add_to_test: |
1614 | | - raise CoroutineFoundException("Found coroutine in SUT: %s", method_name) |
1615 | | - # Coroutine outside the SUT are not problematic, just exclude them. |
1616 | | - LOGGER.debug("Skipping coroutine %s outside of SUT", method_name) |
| 1622 | + LOGGER.warning( |
| 1623 | + "Skipping coroutine %s: Pynguin only tests the non-async parts of this module.", |
| 1624 | + method_name, |
| 1625 | + ) |
| 1626 | + else: |
| 1627 | + LOGGER.debug("Skipping coroutine %s outside of SUT", method_name) |
1617 | 1628 | return |
1618 | 1629 |
|
1619 | 1630 | LOGGER.debug("Analysing method %s.%s", type_info.full_name, method_name) |
|
0 commit comments