File: conftest.py

package info (click to toggle)
python-executing 2.2.0-0.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,860 kB
  • sloc: python: 10,235; sh: 48; makefile: 10
file content (25 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


from typing import Optional, Sequence, Union
from executing._pytest_utils import is_pytest_compatible
import _pytest.assertion.rewrite as rewrite
import importlib.machinery
import types

if not is_pytest_compatible():
    original_find_spec = rewrite.AssertionRewritingHook.find_spec


    def find_spec(
        self,
        name: str,
        path: Optional[Sequence[Union[str, bytes]]] = None,
        target: Optional[types.ModuleType] = None,
    ) -> Optional[importlib.machinery.ModuleSpec]:

        if name == "tests.test_main":
            return None
        return original_find_spec(self, name, path, target)


    rewrite.AssertionRewritingHook.find_spec = find_spec