From 282c84cdd4e4c85261071d89ff5d64e5542d8daf Mon Sep 17 00:00:00 2001 From: "David H. Irving" Date: Tue, 24 Oct 2023 13:13:15 -0700 Subject: [PATCH] Move server code into a subpackage --- .../butler/remote_butler/server/__init__.py | 28 +++++++++++++++++++ .../server/_server.py} | 0 .../server/_server_models.py} | 0 tests/test_server.py | 7 +++-- 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 python/lsst/daf/butler/remote_butler/server/__init__.py rename python/lsst/daf/butler/{server.py => remote_butler/server/_server.py} (100%) rename python/lsst/daf/butler/{server_models.py => remote_butler/server/_server_models.py} (100%) diff --git a/python/lsst/daf/butler/remote_butler/server/__init__.py b/python/lsst/daf/butler/remote_butler/server/__init__.py new file mode 100644 index 0000000000..0377dc8a5d --- /dev/null +++ b/python/lsst/daf/butler/remote_butler/server/__init__.py @@ -0,0 +1,28 @@ +# This file is part of daf_butler. +# +# Developed for the LSST Data Management System. +# This product includes software developed by the LSST Project +# (http://www.lsst.org). +# See the COPYRIGHT file at the top-level directory of this distribution +# for details of code ownership. +# +# This software is dual licensed under the GNU General Public License and also +# under a 3-clause BSD license. Recipients may choose which of these licenses +# to use; please see the files gpl-3.0.txt and/or bsd_license.txt, +# respectively. If you choose the GPL option then the following text applies +# (but note that there is still no warranty even if you opt for BSD instead): +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from ._server import app diff --git a/python/lsst/daf/butler/server.py b/python/lsst/daf/butler/remote_butler/server/_server.py similarity index 100% rename from python/lsst/daf/butler/server.py rename to python/lsst/daf/butler/remote_butler/server/_server.py diff --git a/python/lsst/daf/butler/server_models.py b/python/lsst/daf/butler/remote_butler/server/_server_models.py similarity index 100% rename from python/lsst/daf/butler/server_models.py rename to python/lsst/daf/butler/remote_butler/server/_server_models.py diff --git a/tests/test_server.py b/tests/test_server.py index de0bc682dd..f18a6a81c8 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -29,11 +29,12 @@ import unittest try: + import lsst.daf.butler.remote_butler.server._server + # Failing to import any of these should disable the tests. - import lsst.daf.butler.server from fastapi.testclient import TestClient from lsst.daf.butler.remote_butler import RemoteButler - from lsst.daf.butler.server import app + from lsst.daf.butler.remote_butler.server._server import app except ImportError: TestClient = None app = None @@ -74,7 +75,7 @@ def setUpClass(cls): # Globally change where the server thinks its butler repository # is located. This will prevent any other server tests and is # not a long term fix. - lsst.daf.butler.server.BUTLER_ROOT = cls.root + lsst.daf.butler.remote_butler.server._server.BUTLER_ROOT = cls.root cls.client = TestClient(app) cls.butler = _make_remote_butler(cls.client)