Skip to content

Commit 5033987

Browse files
committed
test(examples): set examples folder from envvar
1 parent 1d7e511 commit 5033987

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

test/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@
1414
logging.getLogger('version_query').setLevel(
1515
getattr(logging, os.environ.get('LOGGING_LEVEL', 'debug').upper()))
1616
logging.getLogger('test').setLevel(logging.DEBUG)
17+
18+
if 'EXAMPLE_PROJECTS_PATH' not in os.environ:
19+
os.environ['EXAMPLE_PROJECTS_PATH'] = '..'

test/examples.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Examples for tests."""
22

33
import itertools
4+
import os
45
import pathlib
56
import platform
67
import sys
@@ -10,11 +11,7 @@
1011

1112
_HERE = pathlib.Path(__file__).resolve().parent
1213

13-
_PACKAGE_FOLDER = _HERE.parent
14-
15-
_GIT_REPOS_ROOT = _PACKAGE_FOLDER.parent
16-
if platform.system() != 'Windows':
17-
_GIT_REPOS_ROOT = _GIT_REPOS_ROOT.parent
14+
_GIT_REPOS_ROOT = pathlib.Path(os.environ['EXAMPLE_PROJECTS_PATH']).absolute()
1815

1916
GIT_REPO_EXAMPLES = list(_ for _ in _GIT_REPOS_ROOT.glob('**/.git') if _.is_dir())
2017

@@ -42,8 +39,8 @@ def python_lib_dir() -> pathlib.Path:
4239

4340
_SYS_DIST_INFOS = list(PY_LIB_DIR.glob('**/*.dist-info'))
4441
_SYS_EGG_INFOS = list(PY_LIB_DIR.glob('**/*.egg-info'))
45-
_USER_DIST_INFOS = [pth for _ in _PACKAGE_FOLDER.parent.glob('*') for pth in _.glob('*.dist-info')]
46-
_USER_EGG_INFOS = [pth for _ in _PACKAGE_FOLDER.parent.glob('*') for pth in _.glob('*.egg-info')]
42+
_USER_DIST_INFOS = [pth for _ in _GIT_REPOS_ROOT.glob('*') for pth in _.glob('*.dist-info')]
43+
_USER_EGG_INFOS = [pth for _ in _GIT_REPOS_ROOT.glob('*') for pth in _.glob('*.egg-info')]
4744
# print(_SYS_DIST_INFOS, _SYS_EGG_INFOS, _USER_DIST_INFOS, _USER_EGG_INFOS)
4845

4946
METADATA_JSON_EXAMPLE_PATHS = list(itertools.chain.from_iterable(

0 commit comments

Comments
 (0)