Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pip/_internal/build_env/noop.py: 68%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

19 statements  

1from __future__ import annotations 

2 

3import sys 

4from collections.abc import Iterable 

5from types import TracebackType 

6from typing import TYPE_CHECKING 

7 

8from pip._internal.build_env.base import BuildEnvironment 

9 

10if TYPE_CHECKING: 

11 from pip._internal.req.req_install import InstallRequirement 

12 

13 

14class NoOpBuildEnvironment(BuildEnvironment): 

15 """A no-op drop-in replacement for BuildEnvironment""" 

16 

17 def __init__(self) -> None: 

18 self.python_executable = sys.executable 

19 

20 def __enter__(self) -> None: 

21 pass 

22 

23 def __exit__( 

24 self, 

25 exc_type: type[BaseException] | None, 

26 exc_val: BaseException | None, 

27 exc_tb: TracebackType | None, 

28 ) -> None: 

29 pass 

30 

31 def cleanup(self) -> None: 

32 pass 

33 

34 def install_requirements( 

35 self, 

36 requirements: Iterable[str], 

37 prefix_as_string: str, 

38 *, 

39 kind: str, 

40 for_req: InstallRequirement | None = None, 

41 ) -> None: 

42 raise NotImplementedError()