Run the test suite using the kitty binary
This commit is contained in:
parent
fb8eb69c20
commit
4b63ee036e
4
setup.py
4
setup.py
@ -1538,9 +1538,7 @@ def main() -> None:
|
|||||||
args.prefix = os.path.abspath(args.prefix)
|
args.prefix = os.path.abspath(args.prefix)
|
||||||
os.chdir(base)
|
os.chdir(base)
|
||||||
if args.action == 'test':
|
if args.action == 'test':
|
||||||
os.execlp(
|
os.execlp('kitty', 'kitty', '+launch', 'test.py')
|
||||||
sys.executable, sys.executable, 'test.py'
|
|
||||||
)
|
|
||||||
if args.action == 'clean':
|
if args.action == 'clean':
|
||||||
clean()
|
clean()
|
||||||
return
|
return
|
||||||
|
|||||||
12
test.py
12
test.py
@ -1,16 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env -S kitty +launch
|
||||||
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import warnings
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
|
|
||||||
base = os.path.dirname(os.path.abspath(__file__))
|
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def env_vars(**kw: str) -> Iterator[None]:
|
def env_vars(**kw: str) -> Iterator[None]:
|
||||||
@ -26,18 +23,12 @@ def env_vars(**kw: str) -> Iterator[None]:
|
|||||||
os.environ[k] = v
|
os.environ[k] = v
|
||||||
|
|
||||||
|
|
||||||
def init_env() -> None:
|
|
||||||
sys.path.insert(0, base)
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
warnings.simplefilter('error')
|
warnings.simplefilter('error')
|
||||||
current_home = os.path.expanduser('~') + os.sep
|
current_home = os.path.expanduser('~') + os.sep
|
||||||
paths = os.environ.get('PATH', '/usr/local/sbin:/usr/local/bin:/usr/bin').split(os.pathsep)
|
paths = os.environ.get('PATH', '/usr/local/sbin:/usr/local/bin:/usr/bin').split(os.pathsep)
|
||||||
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')
|
||||||
if not hasattr(sys, 'kitty_run_data'):
|
|
||||||
setattr(sys, 'kitty_run_data', {'bundle_exe_dir': launcher_dir, 'from_source': True})
|
|
||||||
path = f'{launcher_dir}{os.pathsep}{path}'
|
path = f'{launcher_dir}{os.pathsep}{path}'
|
||||||
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,
|
||||||
@ -46,7 +37,6 @@ def main() -> None:
|
|||||||
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'),
|
||||||
):
|
):
|
||||||
init_env()
|
|
||||||
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