diff --git a/jupyterlab_launcher/tests/app-settings/overrides.json b/jupyterlab_launcher/tests/app-settings/overrides.json new file mode 100644 index 00000000..3d39e80e --- /dev/null +++ b/jupyterlab_launcher/tests/app-settings/overrides.json @@ -0,0 +1,5 @@ +{ + "@jupyterlab/apputils-extension:themes": { + "theme": "JupyterLab Dark" + } +} diff --git a/jupyterlab_launcher/tests/test_settings_api.py b/jupyterlab_launcher/tests/test_settings_api.py index 55d9b581..faa7f511 100644 --- a/jupyterlab_launcher/tests/test_settings_api.py +++ b/jupyterlab_launcher/tests/test_settings_api.py @@ -23,21 +23,35 @@ class SettingsAPITest(LabTestBase): """Test the settings web service API""" def setUp(self): + # Copy the schema files. src = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'schemas', '@jupyterlab') dst = os.path.join(self.lab_config.schemas_dir, '@jupyterlab') - if not os.path.exists(dst): - shutil.copytree(src, dst) + if os.path.exists(dst): + shutil.rmtree(dst) + shutil.copytree(src, dst) + + # Copy the overrides file. + src = os.path.join( + os.path.abspath(os.path.dirname(__file__)), + 'app-settings', + 'overrides.json') + dst = os.path.join(self.lab_config.app_settings_dir, 'overrides.json') + if os.path.exists(dst): + os.remove(dst) + shutil.copyfile(src, dst) self.settings_api = SettingsAPI(self.request) def test_get(self): id = '@jupyterlab/apputils-extension:themes' data = self.settings_api.get(id).json() + schema = data['schema'] assert data['id'] == id - assert len(data['schema']) + # Check that overrides.json file is respected. + assert schema['properties']['theme']['default'] == 'JupyterLab Dark' assert 'raw' in data def test_get_bad(self): diff --git a/jupyterlab_launcher/tests/test_workspaces_api.py b/jupyterlab_launcher/tests/test_workspaces_api.py index b663cdce..bf1cf817 100644 --- a/jupyterlab_launcher/tests/test_workspaces_api.py +++ b/jupyterlab_launcher/tests/test_workspaces_api.py @@ -31,8 +31,9 @@ def setUp(self): for item in os.listdir(data): src = os.path.join(data, item) dst = os.path.join(self.lab_config.workspaces_dir, item) - if not os.path.exists(dst): - shutil.copy(src, self.lab_config.workspaces_dir) + if os.path.exists(dst): + os.remove(dst) + shutil.copy(src, self.lab_config.workspaces_dir) self.workspaces_api = WorkspacesAPI(self.request) def test_delete(self): diff --git a/jupyterlab_launcher/tests/utils.py b/jupyterlab_launcher/tests/utils.py index 38aacad2..290a32be 100644 --- a/jupyterlab_launcher/tests/utils.py +++ b/jupyterlab_launcher/tests/utils.py @@ -44,6 +44,7 @@ def tmp(*parts): cls.config_dir = tmp('config') cls.runtime_dir = tmp('runtime') cls.lab_dir = tmp('lab') + cls.app_settings_dir = tmp('appsettings') cls.lab_schemas = tmp('labschemas') cls.lab_settings = tmp('labsettings') cls.lab_workspaces = tmp('labworkspaces') @@ -60,6 +61,7 @@ def tmp(*parts): }) cls.env_patch.start() cls.lab_config = LabConfig( + app_settings_dir=cls.app_settings_dir, schemas_dir=cls.lab_schemas, user_settings_dir=cls.lab_settings, workspaces_dir=cls.lab_workspaces) diff --git a/jupyterlab_launcher/tests/workspaces/foo.jupyterlab-workspace b/jupyterlab_launcher/tests/workspaces/foo.jupyterlab-workspace index 02bdc619..1a0de541 100644 --- a/jupyterlab_launcher/tests/workspaces/foo.jupyterlab-workspace +++ b/jupyterlab_launcher/tests/workspaces/foo.jupyterlab-workspace @@ -1 +1 @@ -{"data": {}, "metadata": {"id": "foo"}} \ No newline at end of file +{"data": {}, "metadata": {"id": "foo"}} diff --git a/setup.py b/setup.py index b69882d7..7626b3da 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,6 @@ name = 'jupyterlab_launcher', version = __version__, packages = find_packages('.'), - package_data = { 'jupyterlab_launcher': ['*.html'] }, description = "Jupyter Launcher", long_description= """ This package is used to launch an application built using JupyterLab @@ -39,6 +38,7 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', ], + include_package_data = True ) if 'setuptools' in sys.modules: