From efd1cd6e0ffa6759f24ff9c43ceb4fdbaab897c5 Mon Sep 17 00:00:00 2001 From: sdc50 Date: Fri, 29 Nov 2024 09:59:55 -0700 Subject: [PATCH] 4.3 What's New (#1120) * fix docs for python 3.13 * 4.3 what's new * remove python 3.13 * Change Django 5.0 to 5.1 on Docker builds. Add Python 3.13 to build and test matrix. * remove python 3.13 from build bugfix for scaffold command * lint * fix tests * Revert to os.walk in scaffold_commands (Path.walk only supported in Python 3.12+) * Fix mock os.walk in scaffold command tests to return strings for dir path. * Fix scaffold command Path issue --------- Co-authored-by: Nathan Swain --- .github/workflows/tethys-release.yml | 2 +- .github/workflows/tethys.yml | 6 +- CITATION.cff | 4 +- docs/conf.py | 2 +- docs/tethys_portal/configuration.rst | 50 ++++++----- docs/whats_new.rst | 87 +++++------------- docs/whats_new/prior_releases.rst | 88 +++++++++++++++++++ .../test_tethys_cli/test_scaffold_commands.py | 88 +++++++++---------- tethys_cli/scaffold_commands.py | 3 +- 9 files changed, 188 insertions(+), 142 deletions(-) diff --git a/.github/workflows/tethys-release.yml b/.github/workflows/tethys-release.yml index a4332bdb8..63ecaea94 100644 --- a/.github/workflows/tethys-release.yml +++ b/.github/workflows/tethys-release.yml @@ -20,7 +20,7 @@ jobs: matrix: platform: [ubuntu-latest] python-version: ["3.10", "3.11", "3.12"] - django-version: ["3.2", "4.2", "5.0"] + django-version: ["3.2", "4.2", "5.1"] steps: # Checkout the source - name: Checkout Source diff --git a/.github/workflows/tethys.yml b/.github/workflows/tethys.yml index 01dd844e4..67533d264 100644 --- a/.github/workflows/tethys.yml +++ b/.github/workflows/tethys.yml @@ -57,7 +57,7 @@ jobs: matrix: platform: [ubuntu-latest, macos-latest] python-version: ["3.10", "3.11", "3.12"] - django-version: ["3.2", "4.2", "5.0"] + django-version: ["3.2", "4.2", "5.1"] steps: # Checkout the source - name: Checkout Source @@ -100,7 +100,7 @@ jobs: matrix: platform: [ubuntu-latest] python-version: ["3.10", "3.11", "3.12"] - django-version: ["3.2", "4.2", "5.0"] + django-version: ["3.2", "4.2", "5.1"] steps: # Checkout the source - name: Checkout Source @@ -140,7 +140,7 @@ jobs: matrix: platform: [ubuntu-latest] python-version: ["3.10", "3.11", "3.12"] - django-version: ["3.2", "4.2", "5.0"] + django-version: ["3.2", "4.2", "5.1"] services: tethys-postgis: image: postgis/postgis:14-3.3 diff --git a/CITATION.cff b/CITATION.cff index 3923694a7..a52a0f36e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,8 +1,8 @@ cff-version: 1.2.0 message: "If you use this software, please cite it as below." title: "Tethys Platform" -version: 4.2 -date-released: 2023-11-10 +version: 4.3 +date-released: 2024-11-29 url: "https://github.com/tethysplatform/tethys" authors: - family-names: "Swain" diff --git a/docs/conf.py b/docs/conf.py index f51526c28..a210cd2e6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -106,7 +106,7 @@ def __getattr__(cls, name): # patcher.start() # Fixes django settings module problem -sys.path.insert(0, Path("..").absolute().resolve()) +sys.path.insert(0, str(Path("..").absolute().resolve())) installed_apps = [ "django.contrib.admin", diff --git a/docs/tethys_portal/configuration.rst b/docs/tethys_portal/configuration.rst index 6ded214ed..3ddae430f 100644 --- a/docs/tethys_portal/configuration.rst +++ b/docs/tethys_portal/configuration.rst @@ -55,16 +55,18 @@ Tethys Portal settings. Note: do not edit the :file:`settings.py` file directly, ================================================== ================================================================================ Setting Description ================================================== ================================================================================ -SECRET_KEY the Django `SECRET_KEY `_ setting. Automatically generated if not set, however setting it manually is recommended. -DEBUG the Django `DEBUG `_ setting. Defaults to True. -ALLOWED_HOSTS the Django `ALLOWED_HOSTS `_ setting. Defaults to ``[]``. -ADMINS the Django `ADMINS `_ setting. -INSTALLED_APPS the Django `INSTALLED_APPS `_ setting. For convenience, any Django apps listed here will be appended to default list of Django apps required by Tethys. To override ``INSTALLED_APPS`` completely, use the ``INSTALLED_APPS_OVERRIDE`` setting. +SECRET_KEY the Django `SECRET_KEY `_ setting. Automatically generated if not set, however setting it manually is recommended. +DEBUG the Django `DEBUG `_ setting. Defaults to True. +ALLOWED_HOSTS the Django `ALLOWED_HOSTS `_ setting. Defaults to ``[]``. +ADMINS the Django `ADMINS `_ setting. +INSTALLED_APPS the Django `INSTALLED_APPS `_ setting. For convenience, any Django apps listed here will be appended to default list of Django apps required by Tethys. To override ``INSTALLED_APPS`` completely, use the ``INSTALLED_APPS_OVERRIDE`` setting. INSTALLED_APPS_OVERRIDE override for ``INSTALLED_APPS`` setting. CAUTION: improper use of this setting can break the Tethys Portal. -MIDDLEWARE the Django `MIDDLEWARE `_ setting. For convenience, any middleware listed here will be appended to default list of middleware required by Tethys. To override ``MIDDLEWARE`` completely, use the ``MIDDLEWARE_OVERRIDE`` setting. +MIDDLEWARE the Django `MIDDLEWARE `_ setting. For convenience, any middleware listed here will be appended to default list of middleware required by Tethys. To override ``MIDDLEWARE`` completely, use the ``MIDDLEWARE_OVERRIDE`` setting. MIDDLEWARE_OVERRIDE override for ``MIDDLEWARE`` setting. CAUTION: improper use of this setting can break the Tethys Portal. -AUTHENTICATION_BACKENDS the Django `AUTHENTICATION_BACKENDS `_ setting. For convenience, any authentication backends listed here will be appended to default list of authentication backends required by Tethys. To override ``AUTHENTICATION_BACKENDS`` completely, use the ``AUTHENTICATION_BACKENDS_OVERRIDE`` setting. +AUTHENTICATION_BACKENDS the Django `AUTHENTICATION_BACKENDS `_ setting. For convenience, any authentication backends listed here will be appended to default list of authentication backends required by Tethys. To override ``AUTHENTICATION_BACKENDS`` completely, use the ``AUTHENTICATION_BACKENDS_OVERRIDE`` setting. AUTHENTICATION_BACKENDS_OVERRIDE override for ``AUTHENTICATION_BACKENDS`` setting. CAUTION: improper use of this setting can break the Tethys Portal. +CONTEXT_PROCESSORS the `context_processors` option of the Django `TEMPLATES `_ setting. For convenience, any context processor functions listed here will be appended to default list of context processors used by Tethys. To override ``CONTEXT_PROCESSORS`` completely, use the ``CONTEXT_PROCESSORS_OVERRIDE`` setting. +CONTEXT_PROCESSORS_OVERRIDE override for ``CONTEXT_PROCESSORS`` setting. CAUTION: improper use of this setting can break the Tethys Portal. RESOURCE_QUOTA_HANDLERS a list of Tethys ``ResourceQuotaHandler`` classes to load (see: :ref:`sdk_quotas_api`). For convenience, any quota handlers listed here will be appended to the default list of quota handlerss. To override ``RESOURCE_QUOTA_HANDLERS`` completely, use the ``RESOURCE_QUOTA_HANDLERS_OVERRIDE`` setting. RESOURCE_QUOTA_HANDLERS_OVERRIDE override for ``RESOURCE_QUOTA_HANDLERS`` setting. CAUTION: improper use of this setting can break the Tethys Portal. USE_OLD_WORKSPACES_API a temporary setting that maintains backward compatibility for the :ref:`tethys_workspaces_api` when True. When False the the new :ref:`tethys_paths_api` functionality will apply. Defaults to True. Will be removed in 5.0. @@ -83,9 +85,9 @@ REGISTER_CONTROLLER override the default registra ENABLE_OPEN_PORTAL no login required for Tethys Portal when ``True``. Defaults to ``False``. Controllers in apps need to use the ``controller`` decorator from the Tethys SDK, rather than Django's ``login_required`` decorator. ENABLE_RESTRICTED_APP_ACCESS app access can be restricted based on user object permissions when ``True``. Defaults to ``False``. A list can also be provided to restrict specific applications. If ``ENABLE_OPEN_PORTAL`` is set to ``True`` this setting has no effect. That is, users will have unrestricted access to apps independently of the value of this setting. TETHYS_WORKSPACES_ROOT location to where app/user workspaces will be created. Defaults to :file:`/workspaces`. -STATIC_ROOT the Django `STATIC_ROOT `_ setting. Defaults to :file:`/static`. -MEDIA_URL the Django `MEDIA_URL `_ setting. Defaults to ``'/media/'``. -MEDIA_ROOT the Django `MEDIA_ROOT `_ setting. Defaults to :file:`~/.tethys/media/`. +STATIC_ROOT the Django `STATIC_ROOT `_ setting. Defaults to :file:`/static`. +MEDIA_URL the Django `MEDIA_URL `_ setting. Defaults to ``'/media/'``. +MEDIA_ROOT the Django `MEDIA_ROOT `_ setting. Defaults to :file:`~/.tethys/media/`. STATICFILES_USE_NPM serves JavaScript dependencies through Tethys rather than using a content delivery network (CDN) when ``True``. Defaults to ``False``. When set to ``True`` then you must run ``tethys gen package_json`` to npm install the JS dependencies locally so they can be served by Tethys. ADDITIONAL_TEMPLATE_DIRS a list of dot-paths to template directories. These will be prepended to Tethys's list of template directories so specific templates can be overriden. ADDITIONAL_URLPATTERNS a list of dot-paths to list or tuples that define additional URL patterns to register in the portal. Additional URL patterns will precede default URL patterns so URLs will first match against user specified URL patterns. @@ -121,24 +123,24 @@ SESSION_SECURITY_EXPIRE_AFTER the Django Session Security ` DATABASES +++++++++ -See the Django `DATABASES `_ setting. +See the Django `DATABASES `_ setting. +-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Setting | Description | +=============+==================================================================================================================================================================================================================================================================================================================================================================================================================================================+ | default | | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | ENGINE | the Django default database `ENGINE `_ setting. Default is ``django.db.backends.sqlite3``. | +| | ENGINE | the Django default database `ENGINE `_ setting. Default is ``django.db.backends.sqlite3``. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | NAME | the Django default databases `NAME `_ setting. If using the ``sqlite3`` ``ENGINE`` (default) then the default value for name will be ``tethys_platform.sqlite`` and will be located in the ``TETHYS_HOME`` directory. If another ``ENGINE`` is used then the default value is ``tethys_platform``. | +| | NAME | the Django default databases `NAME `_ setting. If using the ``sqlite3`` ``ENGINE`` (default) then the default value for name will be ``tethys_platform.sqlite`` and will be located in the ``TETHYS_HOME`` directory. If another ``ENGINE`` is used then the default value is ``tethys_platform``. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | USER | the Django default database `USER `_ setting. Not used with SQLite. | +| | USER | the Django default database `USER `_ setting. Not used with SQLite. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | PASSWORD | the Django default database `PASSWORD `_ setting. Not used with SQLite. | +| | PASSWORD | the Django default database `PASSWORD `_ setting. Not used with SQLite. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | HOST | the Django default database `HOST `_ setting. Not used with SQLite. | +| | HOST | the Django default database `HOST `_ setting. Not used with SQLite. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| | PORT | the Django default database `PORT `_ setting. Not used with SQLite. | +| | PORT | the Django default database `PORT `_ setting. Not used with SQLite. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | | DIR | name of psql directory for a local PostgreSQL database (if using the ``django.db.backends.postgresql`` ``ENGINE``). This directory will be created relative to the ``TETHYS_HOME`` directory when ``tethys db create`` is executed, unless an absolute path is provided. If you are using the ``sqlite3`` ``ENGINE`` or an external database server then exclude this key or set it to `None`. | +--+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -395,12 +397,12 @@ EMAIL_CONFIG ================================================== ================================================================================ Setting Description ================================================== ================================================================================ -EMAIL_HOST the Django `EMAIL_HOST `_ setting. -EMAIL_PORT the Django `EMAIL_PORT `_ setting. -EMAIL_HOST_USER the Django `EMAIL_HOST_USER `_ setting. -EMAIL_HOST_PASSWORD the Django `EMAIL_HOST_PASSWORD `_ setting. -EMAIL_USE_TLS the Django `EMAIL_USE_TLS `_ setting. -DEFAULT_FROM_EMAIL the Django `DEFAULT_FROM_EMAIL `_ setting. +EMAIL_HOST the Django `EMAIL_HOST `_ setting. +EMAIL_PORT the Django `EMAIL_PORT `_ setting. +EMAIL_HOST_USER the Django `EMAIL_HOST_USER `_ setting. +EMAIL_HOST_PASSWORD the Django `EMAIL_HOST_PASSWORD `_ setting. +EMAIL_USE_TLS the Django `EMAIL_USE_TLS `_ setting. +DEFAULT_FROM_EMAIL the Django `DEFAULT_FROM_EMAIL `_ setting. EMAIL_FROM the email alias setting (e.g.: 'John Smith'). ================================================== ================================================================================ @@ -496,7 +498,7 @@ Other Settings Setting Description ================================================== ================================================================================ CHANNEL_LAYERS the Django Channels `CHANNEL_LAYERS `_ setting. -AUTH_PASSWORD_VALIDATORS the Django `AUTH_PASSWORD_VALIDATORS `_ setting. +AUTH_PASSWORD_VALIDATORS the Django `AUTH_PASSWORD_VALIDATORS `_ setting. GUARDIAN_RAISE_403 the Django Guardian `GUARDIAN_RAISE_403 `_ setting. GUARDIAN_RENDER_403 the Django Guardian `GUARDIAN_RENDER_403 `_ setting. GUARDIAN_TEMPLATE_403 the Django Guardian `GUARDIAN_TEMPLATE_403 `_ setting. diff --git a/docs/whats_new.rst b/docs/whats_new.rst index 162f9c66c..ede12d736 100644 --- a/docs/whats_new.rst +++ b/docs/whats_new.rst @@ -4,95 +4,50 @@ What's New ********** -**Last Updated:** November 2023 +**Last Updated:** November 2024 Refer to this article for information about each new release of Tethys Platform. Release |version| ================== -Python 3.12 ------------ +Major Features +-------------- -* Verified Tethys Platform works using Python 3.12 +Django 4/5 Support +.................. -Conda Forge Package -------------------- - -* Tethys Platform is now fully packaged on conda-forge! +* Tethys Platform 4.3 is compatible with Django versions 3.2 - 5.x. It is now recommended to explicitly specify the version of Django that you want when you create your tethys environment. See: :ref:`development_installation` -Optional Dependencies and Micro Tethys --------------------------------------- - -* Made many of the dependencies of ``tethys-platform`` optional and released new ``micro-tethys-platform`` conda package on the ``tethysplatform`` channel with minimal dependencies -* Updated docs to reflect what features are now optional and what dependencies are needed to support those features - -.. note:: - - The ``tethys-platform`` conda package for version 4.2 will still install all of the optional dependencies for backwards compatibility. Starting with Tethys version 5.0 the ``tethys-platform`` package will only have required dependencies. The ``micro-tethys-platform`` package, available on the ``tethysplatform`` channel, will install only the required dependencies allowing for a smaller Tethys environment. - -See: :ref:`optional_features`, :ref:`development_installation` - -Map Layout ----------- - -* Add labeling support for geojson features in MapLayout and MapView Gizmo. - -See: `label_options` in :ref:`map_layout` +New Logo +........ -Admin Pages ------------ +* The new logo design that is on the `Tethys Platform `_ website is now in the default configuration of the Tethys Portal. -* Added ability to have an icon on proxy app cards in the apps library to distinguish from native apps +Single App Mode +............... -See: :ref:`portal_admin_proxy_apps` +* Tethys can now be used to deploy just a single app by setting the new `MULTIPLE_APP_MODE` setting to `False`. -Settings --------- +See: :ref:`tethys_portal_config_settings` -* Added new ``PREFIX_URL`` to enable modifying all portal URLs with a prefix -* Added new settings ``ADDITIONAL_URLPATTERNS`` and ``ADDITIONAL_TEMPLATE_DIRS`` to allow more flexibility for supporting Django plugins -* Replaced deprecated setting ``AXES_ONLY_USER_FAILURES`` with recommended setting ``AXES_LOCKOUT_PARAMETERS`` +Paths API +......... -See: :ref:`tethys_configuration` +* The new Paths API replaces the Workspaces API (which will still be supported until version 5.0) and provides access to the new Media directories and the App Resources directory. It also makes better use of the Python `pathlib` library. -OAuth2 Provider ---------------- +See: :ref:`tethys_paths_api` -* Added support for the Django OAuth Toolkit plugin to allow a Tethys portal to be an OAuth provider. +Async Support for the Jobs Table Gizmo +...................................... -See: :ref:`optional_features` - -Tethys CLI ----------- - -* Added a ``--urls`` option to the ``tethys list`` command to list the ``UrlMaps`` for apps. - -See: :ref:`tethys_list_cmd` - -Bokeh ------ - -* Added support for Bokeh version 3 - -Jobs Table Gizmo ----------------- - -* Added a ``cached_status`` property to Tethys Jobs and optimized how the ``JobsTable`` gizmo loads statuses -* Added ability to sort jobs in the ``JobsTable`` gizmo and specify sorting key +* Jobs Table actions callbacks are now asynchronous enabling them to run without blocking the webserver. Custom actions can also be `async`. See: :ref:`jobs-table` -Bug Fixes ---------- - -* Fixed issue with the TethysJob update-status callback endpoint not updating job status -* Fixed issue with assigning Custom JSON setting error when installing from file -* Fixed `Issue 985 Remove References to UrlMaps in Gizmo Docs `_ -* Fixed `Issue 881 The OneLoginOIDC Oauth backend is not compatible with the latest version of social-auth-core `_ -* Fixed `Issue 976 Invalid Links for Map View Controls `_ +For a full list of changes in version 4.3 refer to ``_ Prior Release Notes =================== diff --git a/docs/whats_new/prior_releases.rst b/docs/whats_new/prior_releases.rst index 1cb50c2e2..7a866df98 100644 --- a/docs/whats_new/prior_releases.rst +++ b/docs/whats_new/prior_releases.rst @@ -6,6 +6,94 @@ Prior Release Notes Information about prior releases is shown here. + +Release 4.2 +=========== + +Python 3.12 +----------- + +* Verified Tethys Platform works using Python 3.12 + +Conda Forge Package +------------------- + +* Tethys Platform is now fully packaged on conda-forge! + +See: :ref:`development_installation` + +Optional Dependencies and Micro Tethys +-------------------------------------- + +* Made many of the dependencies of ``tethys-platform`` optional and released new ``micro-tethys-platform`` conda package on the ``tethysplatform`` channel with minimal dependencies +* Updated docs to reflect what features are now optional and what dependencies are needed to support those features + +.. note:: + + The ``tethys-platform`` conda package for version 4.2 will still install all of the optional dependencies for backwards compatibility. Starting with Tethys version 5.0 the ``tethys-platform`` package will only have required dependencies. The ``micro-tethys-platform`` package, available on the ``tethysplatform`` channel, will install only the required dependencies allowing for a smaller Tethys environment. + +See: :ref:`optional_features`, :ref:`development_installation` + +Map Layout +---------- + +* Add labeling support for geojson features in MapLayout and MapView Gizmo. + +See: `label_options` in :ref:`map_layout` + +Admin Pages +----------- + +* Added ability to have an icon on proxy app cards in the apps library to distinguish from native apps + +See: :ref:`portal_admin_proxy_apps` + +Settings +-------- + +* Added new ``PREFIX_URL`` to enable modifying all portal URLs with a prefix +* Added new settings ``ADDITIONAL_URLPATTERNS`` and ``ADDITIONAL_TEMPLATE_DIRS`` to allow more flexibility for supporting Django plugins +* Replaced deprecated setting ``AXES_ONLY_USER_FAILURES`` with recommended setting ``AXES_LOCKOUT_PARAMETERS`` + +See: :ref:`tethys_configuration` + +OAuth2 Provider +--------------- + +* Added support for the Django OAuth Toolkit plugin to allow a Tethys portal to be an OAuth provider. + +See: :ref:`optional_features` + +Tethys CLI +---------- + +* Added a ``--urls`` option to the ``tethys list`` command to list the ``UrlMaps`` for apps. + +See: :ref:`tethys_list_cmd` + +Bokeh +----- + +* Added support for Bokeh version 3 + +Jobs Table Gizmo +---------------- + +* Added a ``cached_status`` property to Tethys Jobs and optimized how the ``JobsTable`` gizmo loads statuses +* Added ability to sort jobs in the ``JobsTable`` gizmo and specify sorting key + +See: :ref:`jobs-table` + +Bug Fixes +--------- + +* Fixed issue with the TethysJob update-status callback endpoint not updating job status +* Fixed issue with assigning Custom JSON setting error when installing from file +* Fixed `Issue 985 Remove References to UrlMaps in Gizmo Docs `_ +* Fixed `Issue 881 The OneLoginOIDC Oauth backend is not compatible with the latest version of social-auth-core `_ +* Fixed `Issue 976 Invalid Links for Map View Controls `_ + + Release 4.1 =========== diff --git a/tests/unit_tests/test_tethys_cli/test_scaffold_commands.py b/tests/unit_tests/test_tethys_cli/test_scaffold_commands.py index 0735e0cd9..84b23faba 100644 --- a/tests/unit_tests/test_tethys_cli/test_scaffold_commands.py +++ b/tests/unit_tests/test_tethys_cli/test_scaffold_commands.py @@ -133,7 +133,7 @@ def test_scaffold_command( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -163,9 +163,9 @@ def test_scaffold_command( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -278,7 +278,7 @@ def test_scaffold_command_with_no_extension( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -307,9 +307,9 @@ def test_scaffold_command_with_no_extension( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -380,7 +380,7 @@ def test_scaffold_command_with_uppercase_project_name( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -410,9 +410,9 @@ def test_scaffold_command_with_uppercase_project_name( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -530,7 +530,7 @@ def test_scaffold_command_with_project_warning( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -559,9 +559,9 @@ def test_scaffold_command_with_project_warning( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -639,7 +639,7 @@ def test_scaffold_command_with_no_defaults( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -670,9 +670,9 @@ def test_scaffold_command_with_no_defaults( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -757,7 +757,7 @@ def test_scaffold_command_with_no_defaults_input_exception( _, __, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -788,9 +788,9 @@ def test_scaffold_command_with_no_defaults_input_exception( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs")), ] mock_mkdir.return_value = True @@ -852,7 +852,7 @@ def test_scaffold_command_with_no_defaults_invalid_response( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -884,9 +884,9 @@ def test_scaffold_command_with_no_defaults_invalid_response( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -979,7 +979,7 @@ def test_scaffold_command_with_no_overwrite( __, ___, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -1010,9 +1010,9 @@ def test_scaffold_command_with_no_overwrite( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs_tmpl")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs_tmpl")), ] mock_mkdir.return_value = True @@ -1090,7 +1090,7 @@ def test_scaffold_command_with_no_overwrite_keyboard_interrupt( _, __, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -1121,9 +1121,9 @@ def test_scaffold_command_with_no_overwrite_keyboard_interrupt( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs")), ] mock_mkdir.return_value = True @@ -1184,7 +1184,7 @@ def test_scaffold_command_with_no_overwrite_cancel( _, __, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -1215,9 +1215,9 @@ def test_scaffold_command_with_no_overwrite_cancel( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs")), ] mock_mkdir.return_value = True @@ -1278,7 +1278,7 @@ def test_scaffold_command_with_no_overwrite_os_error( _, __, mock_mkdir, - mock_path_walk, + mock_os_walk, mock_render_path, mock_rmt, mock_is_dir, @@ -1309,9 +1309,9 @@ def test_scaffold_command_with_no_overwrite_os_error( mock_render_path.return_value = "" - mock_path_walk.return_value = [ - (Path("/").absolute() / "foo", ("bar",), ("baz",)), - (Path("/").absolute() / "foo" / "bar", (), ("spam", "eggs")), + mock_os_walk.return_value = [ + (str(Path("/").absolute() / "foo"), ("bar",), ("baz",)), + (str(Path("/").absolute() / "foo" / "bar"), (), ("spam", "eggs")), ] mock_mkdir.return_value = True diff --git a/tethys_cli/scaffold_commands.py b/tethys_cli/scaffold_commands.py index 1e08fd44d..62d97c783 100644 --- a/tethys_cli/scaffold_commands.py +++ b/tethys_cli/scaffold_commands.py @@ -2,8 +2,8 @@ import logging import random import shutil -from pathlib import Path from os import walk +from pathlib import Path from jinja2 import Template from tethys_cli.cli_colors import write_pretty_output, FG_RED, FG_YELLOW, FG_WHITE @@ -424,6 +424,7 @@ def scaffold_command(args): ) curr_project_root = render_path(curr_project_root, context) curr_project_root = Path(curr_project_root) + curr_template_root = Path(curr_template_root) # Create Root Directory curr_project_root.mkdir(parents=True)