Pass through python used for type check to the test code from before the env is sanitized
This commit is contained in:
parent
98eacb2067
commit
5ea0519f62
@ -66,7 +66,7 @@ def type_check() -> NoReturn:
|
|||||||
generate_stub()
|
generate_stub()
|
||||||
from kittens.tui.operations_stub import generate_stub # type: ignore
|
from kittens.tui.operations_stub import generate_stub # type: ignore
|
||||||
generate_stub()
|
generate_stub()
|
||||||
py = shutil.which('python') or shutil.which('python3')
|
py = os.environ.get('PYTHON_FOR_TYPE_CHECK') or shutil.which('python') or shutil.which('python3')
|
||||||
os.execlp(py, py, '-m', 'mypy', '--pretty')
|
os.execlp(py, py, '-m', 'mypy', '--pretty')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
test.py
4
test.py
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import warnings
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
@ -30,13 +31,14 @@ def main() -> None:
|
|||||||
path = os.pathsep.join(x for x in paths if not x.startswith(current_home))
|
path = os.pathsep.join(x for x in paths if not x.startswith(current_home))
|
||||||
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
|
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
|
||||||
path = f'{launcher_dir}{os.pathsep}{path}'
|
path = f'{launcher_dir}{os.pathsep}{path}'
|
||||||
|
PYTHON_FOR_TYPE_CHECK = shutil.which('python') or shutil.which('python3') or ''
|
||||||
with TemporaryDirectory() as tdir, env_vars(
|
with TemporaryDirectory() as tdir, env_vars(
|
||||||
PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, PATH=path,
|
PYTHONWARNINGS='error', HOME=tdir, USERPROFILE=tdir, PATH=path,
|
||||||
XDG_CONFIG_HOME=os.path.join(tdir, '.config'),
|
XDG_CONFIG_HOME=os.path.join(tdir, '.config'),
|
||||||
XDG_CONFIG_DIRS=os.path.join(tdir, '.config'),
|
XDG_CONFIG_DIRS=os.path.join(tdir, '.config'),
|
||||||
XDG_DATA_DIRS=os.path.join(tdir, '.local', 'xdg'),
|
XDG_DATA_DIRS=os.path.join(tdir, '.local', 'xdg'),
|
||||||
XDG_CACHE_HOME=os.path.join(tdir, '.cache'),
|
XDG_CACHE_HOME=os.path.join(tdir, '.cache'),
|
||||||
KITTY_PREWARM_SOCKET='',
|
PYTHON_FOR_TYPE_CHECK=PYTHON_FOR_TYPE_CHECK,
|
||||||
):
|
):
|
||||||
m = importlib.import_module('kitty_tests.main')
|
m = importlib.import_module('kitty_tests.main')
|
||||||
getattr(m, 'run_tests')()
|
getattr(m, 'run_tests')()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user