tethysplatform / tethys

The Tethys Platform main Django website project repository.
http://tethysplatform.org/
BSD 2-Clause "Simplified" License
91 stars 50 forks source link

bokehjsdir() has been deprecated in favor of bokehjs_path() #1022

Closed gronka closed 3 months ago

gronka commented 4 months ago

bokehjsdir() has been deprecated in favor of bokehjs_path()

Using bokehjsdir() now causes an error when running docker build

https://github.com/bokeh/bokeh/blob/69c084e692d79632c97ea1cfc5ceb10d0217e6f4/src/bokeh/settings.py#L779

sdc50 commented 4 months ago

@gronka Add the following test to tests/unit_tests/test_tethys_portal/test_settings.py:


    @mock.patch("tethys_portal.optional_dependencies.optional_import")
    def test_bokehjsdir_compatibility(self, mock_oi):
        mock_bokeh_settings = mock.MagicMock()
        mock_oi.return_value = mock_bokeh_settings
        mock_bokeh_settings.bokehjs_path.side_effect = AttributeError()
        reload(settings)
        mock_bokeh_settings.bokehjs_path.assert_called_once()
        mock_bokeh_settings.bokehjsdir.assert_called_once()

That should provide complete coverage.

sdc50 commented 4 months ago

Once we get this merged, we should also cherry pick the commit to the release branch as a hotfix, so current builds won't break.

@araglu once the hotfix is applied then docker builds using the latest release of Tethys should work again.

gronka commented 3 months ago

@sdc50 Thanks. I added the unit test. The new test passed when I ran the following:

kubectl exec --stdin --tty {POD_NAME} -- /bin/bash
pip install bokeh_django
tethys test -c

... testing output ...
TOTAL                                                             10537   7231    31%

37 files skipped due to complete coverage.

Just so you know, in case this isn't the correct way to run the tests.