(mod, n_in_context)
| 1708 | |
| 1709 | |
| 1710 | def assert_warn_len_equal(mod, n_in_context): |
| 1711 | try: |
| 1712 | mod_warns = mod.__warningregistry__ |
| 1713 | except AttributeError: |
| 1714 | # the lack of a __warningregistry__ |
| 1715 | # attribute means that no warning has |
| 1716 | # occurred; this can be triggered in |
| 1717 | # a parallel test scenario, while in |
| 1718 | # a serial test scenario an initial |
| 1719 | # warning (and therefore the attribute) |
| 1720 | # are always created first |
| 1721 | mod_warns = {} |
| 1722 | |
| 1723 | num_warns = len(mod_warns) |
| 1724 | |
| 1725 | if 'version' in mod_warns: |
| 1726 | # Python adds a 'version' entry to the registry, |
| 1727 | # do not count it. |
| 1728 | num_warns -= 1 |
| 1729 | |
| 1730 | assert_equal(num_warns, n_in_context) |
| 1731 | |
| 1732 | |
| 1733 | def test_warn_len_equal_call_scenarios(): |
no test coverage detected
searching dependent graphs…