anaconda / nb_conda_kernels

Package for managing conda environment-based kernels inside of Jupyter
BSD 3-Clause "New" or "Revised" License
601 stars 70 forks source link

test_install_kernelspec fails with AssertionError on Unix #274

Closed skupr-anaconda closed 3 weeks ago

skupr-anaconda commented 3 weeks ago

I'm trying to build nb_conda_kernels 2.5.0 and getting this error in the test environment on Unix platforms (osx, linux):

=================================== FAILURES ===================================

__________________________ test_install_kernelspec[] ___________________________

tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_install_kernelspec__0')

kernelspec_path = ''

    @pytest.mark.parametrize("kernelspec_path", ["", None])
    def test_install_kernelspec(tmp_path, kernelspec_path):
        config = Config({"CondaKernelSpecManager": {"kernelspec_path": kernelspec_path}})
        with patch("nb_conda_kernels.manager.CondaKernelSpecManager.install_kernel_spec") as install:
            install.return_value = str(tmp_path)

            CondaKernelSpecManager(config=config)

>           assert install.called == (kernelspec_path is not None)

E           AssertionError: assert False == ('' is not None)
E            +  where False = <MagicMock name='install_kernel_spec' id='281473544952656'>.called

tests/test_config.py:179: AssertionError

=========================== short test summary info ============================

FAILED tests/test_config.py::test_install_kernelspec[] - AssertionError: asse...
============ 1 failed, 15 passed, 3 skipped, 1 deselected in 8.42s =============

If I run locally:

+ python -m nb_conda_kernels list
[ListKernelSpecs] nb_conda_kernels | enabled, 1 kernels found.

but if I run on CI:

+ python -m nb_conda_kernels list
[ListKernelSpecs] nb_conda_kernels | enabled, 0 kernels found.

Is there a bug or am I missing something?

mcg1969 commented 3 weeks ago

@skupr-anaconda this has been addressed in #277

Please see the change to the repo's conda recipe

https://github.com/anaconda/nb_conda_kernels/blob/master/conda-recipe/meta.yaml#L42-L43

You can bump your recipe to 2.5.2 to get this