Coverage for src/engines/engine.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-22 10:53 +0000

1#!/usr/bin/env python3 

2 

3# Standard libraries 

4from os import environ 

5 

6# Components 

7from ..package.bundle import Bundle 

8from ..system.platform import Platform 

9 

10# Optional modules libraries (Windows) 

11if Platform.IS_WINDOWS: # pragma: windows cover 

12 

13 # Default engine 

14 if Bundle.ENV_ENGINE not in environ: 

15 environ[Bundle.ENV_ENGINE] = 'wexpect' 

16 

17 # Optional Pexpect engine 

18 if environ[Bundle.ENV_ENGINE] == 'pexpect_popen': 

19 from .pexpect_popen import PexpectPopen as Engine # pylint: disable=unused-import 

20 

21 # Optional Wexpect engine 

22 elif environ[Bundle.ENV_ENGINE] == 'wexpect': 

23 from .wexpect import Wexpect as Engine # type: ignore[assignment] # pylint: disable=unused-import 

24 

25 # Unknown engine 

26 else: 

27 raise NotImplementedError(f'Unknown engine "{environ[Bundle.ENV_ENGINE]}"') 

28 

29# Optional modules libraries (Linux) 

30else: # pragma: linux cover 

31 # Optional Pexpect engine 

32 from .pexpect import Pexpect as Engine # type: ignore[assignment] # pylint: disable=unused-import