Run tests with HOME set to a tempdir
This commit is contained in:
parent
80ab60f1b6
commit
99d9cb0b0d
1 changed files with 6 additions and 3 deletions
9
test.py
9
test.py
|
|
@ -6,6 +6,7 @@
|
|||
import os
|
||||
import sys
|
||||
import warnings
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
base = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
|
@ -17,9 +18,11 @@ def init_env() -> None:
|
|||
def main() -> None:
|
||||
warnings.simplefilter('error')
|
||||
os.environ['PYTHONWARNINGS'] = 'error'
|
||||
init_env()
|
||||
m = importlib.import_module('kitty_tests.main')
|
||||
m.run_tests() # type: ignore
|
||||
with TemporaryDirectory() as tdir:
|
||||
os.environ['HOME'] = os.environ['USERPROFILE'] = tdir
|
||||
init_env()
|
||||
m = importlib.import_module('kitty_tests.main')
|
||||
m.run_tests() # type: ignore
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue