Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/astroid/brain/brain_unittest.py: 86%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:53 +0000
1# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
5"""Astroid hooks for unittest module."""
6from astroid.brain.helpers import register_module_extender
7from astroid.builder import parse
8from astroid.manager import AstroidManager
11def IsolatedAsyncioTestCaseImport():
12 """
13 In the unittest package, the IsolatedAsyncioTestCase class is imported lazily.
15 I.E. only when the ``__getattr__`` method of the unittest module is called with
16 'IsolatedAsyncioTestCase' as argument. Thus the IsolatedAsyncioTestCase
17 is not imported statically (during import time).
18 This function mocks a classical static import of the IsolatedAsyncioTestCase.
20 (see https://github.com/pylint-dev/pylint/issues/4060)
21 """
22 return parse(
23 """
24 from .async_case import IsolatedAsyncioTestCase
25 """
26 )
29register_module_extender(AstroidManager(), "unittest", IsolatedAsyncioTestCaseImport)