(mod, n_in_context)
| 1237 | |
| 1238 | |
| 1239 | def assert_warn_len_equal(mod, n_in_context): |
| 1240 | try: |
| 1241 | mod_warns = mod.__warningregistry__ |
| 1242 | except AttributeError: |
| 1243 | # the lack of a __warningregistry__ |
| 1244 | # attribute means that no warning has |
| 1245 | # occurred; this can be triggered in |
| 1246 | # a parallel test scenario, while in |
| 1247 | # a serial test scenario an initial |
| 1248 | # warning (and therefore the attribute) |
| 1249 | # are always created first |
| 1250 | mod_warns = {} |
| 1251 | |
| 1252 | num_warns = len(mod_warns) |
| 1253 | |
| 1254 | if 'version' in mod_warns: |
| 1255 | # Python 3 adds a 'version' entry to the registry, |
| 1256 | # do not count it. |
| 1257 | num_warns -= 1 |
| 1258 | |
| 1259 | assert_equal(num_warns, n_in_context) |
| 1260 | |
| 1261 | |
| 1262 | def test_warn_len_equal_call_scenarios(): |
no test coverage detected