mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Import TLJH only when needed in conftest.py
This commit is contained in:
@@ -4,12 +4,14 @@ import os
|
|||||||
|
|
||||||
from pytest import fixture
|
from pytest import fixture
|
||||||
|
|
||||||
from tljh.config import CONFIG_FILE, reload_component
|
|
||||||
|
|
||||||
|
|
||||||
@fixture
|
@fixture
|
||||||
def preserve_config(request):
|
def preserve_config(request):
|
||||||
"""Fixture to save and restore config around tests"""
|
"""Fixture to save and restore config around tests"""
|
||||||
|
# Import TLJH only when needed. This lets us run tests in places
|
||||||
|
# where TLJH is not installed - particularly, the 'distro check' test.
|
||||||
|
from tljh.config import CONFIG_FILE, reload_component
|
||||||
if os.path.exists(CONFIG_FILE):
|
if os.path.exists(CONFIG_FILE):
|
||||||
with open(CONFIG_FILE) as f:
|
with open(CONFIG_FILE) as f:
|
||||||
save_config = f.read()
|
save_config = f.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user