|
12 | 12 | The generic lists (`DISPLAYS`, `RULES`, etc...) simply combine all groups into |
13 | 13 | a single list |
14 | 14 | """ |
15 | | -import importlib.util |
16 | 15 | import os |
17 | | -import shutil |
18 | 16 | import sys |
19 | 17 | from copy import deepcopy |
20 | 18 | from pathlib import Path |
21 | 19 |
|
22 | 20 | import pytest |
23 | 21 |
|
24 | | -__pyvda_utils = Path(importlib.util.find_spec('pyvda').origin).parent / 'utils.py' |
| 22 | +if os.getenv('GITHUB_ACTIONS') == 'true': |
| 23 | + # mock pyvda since it's not supported in windows server/GH actions runners |
| 24 | + sys.modules['pyvda'] = type(os)('pyvda') |
25 | 25 |
|
26 | 26 | sys.path.insert(0, str((Path(__file__).parent / '../').resolve())) |
27 | 27 | # allow internal imports like win32_extras |
28 | 28 | sys.path.insert(0, str((Path(__file__).parent / '../src').resolve())) |
29 | 29 | from src import common # noqa:E402 |
30 | 30 |
|
31 | 31 |
|
32 | | -if os.getenv('GITHUB_ACTIONS') == 'true': |
33 | | - |
34 | | - def pytest_sessionstart(): |
35 | | - shutil.copyfile(__pyvda_utils, __pyvda_utils.parent / 'utils-old.py') |
36 | | - |
37 | | - with open(__pyvda_utils, 'r') as f: |
38 | | - contents = f.read().replace( |
39 | | - 'def get_vd_manager_internal2():', |
40 | | - 'def get_vd_manager_internal2():\n return get_vd_manager_internal()', |
41 | | - ) |
42 | | - |
43 | | - with open(__pyvda_utils, 'w') as f: |
44 | | - f.write(contents) |
45 | | - |
46 | | - def pytest_sessionfinish(): |
47 | | - utils_old = __pyvda_utils.parent / 'utils-old.py' |
48 | | - shutil.copyfile(utils_old, __pyvda_utils) |
49 | | - os.remove(utils_old) |
50 | | - |
51 | | - |
52 | 32 | DISPLAYS1 = [ |
53 | 33 | { |
54 | 34 | 'uid': 'UID11111', |
|
0 commit comments