jupyter_core icon indicating copy to clipboard operation
jupyter_core copied to clipboard

save path tests from symlink confusion, fixes #231

Open ivanov opened this issue 2 years ago • 5 comments

following this comment in #231

@mtelka could you please try this out and report back if this fixes the last set of failures you see on your OpenIndiana rig? Thank you!

ivanov avatar Nov 17 '23 04:11 ivanov

I tested jupyter_core 5.5.0 with 5f24503 applied and the failure is very similar to the one reported in https://github.com/jupyter/jupyter_core/issues/231#issuecomment-1738547230.

Please note that /usr/share/jupyter and /usr/local/share/jupyter does not point to the same target so pure realpath() cannot solve the issue. On default OpenIndiana install the /usr/local does not exist. On my test machine it is a symlink to /opt/local as documented here so with 5f24503 the failure of test_jupyter_path_user_site is this now:

_________________________ test_jupyter_path_user_site __________________________

    def test_jupyter_path_user_site():
        with patch.object(site, "ENABLE_USER_SITE", True):
            path = jupyter_path()

            # deduplicated expected values
            values = list(
                dict.fromkeys(
                    [   
                        jupyter_data_dir(),
                        os.path.join(site.getuserbase(), "share", "jupyter"),
                        paths.ENV_JUPYTER_PATH[0],
                    ]
                )
            )
            for p, v in zip(path, values):
>               assert realpath(p) == realpath(v)
E               AssertionError: assert '/opt/local/share/jupyter' == '/usr/share/jupyter'
E                 - /usr/share/jupyter
E                 + /opt/local/share/jupyter

p          = '/usr/local/share/jupyter'
path       = ['/home/marcel/.local/share/jupyter', '/usr/local/share/jupyter', '/usr/share/jupyter']
v          = '/usr/share/jupyter'
values     = ['/home/marcel/.local/share/jupyter', '/usr/share/jupyter']

tests/test_paths.py:300: AssertionError

The other two tests fails with the exactly same error output as before.

mtelka avatar Nov 17 '23 10:11 mtelka

Ah, ok, I wrongly assumed that it was a symlink resolution issue. What do you think is the path forward ?

ivanov avatar Nov 17 '23 19:11 ivanov

What about to find the root cause first? :-)

mtelka avatar Nov 20 '23 06:11 mtelka

What about to find the root cause first? :-)

I fully support that, but lack a system that reproduces this error, which is why I ask for help.

ivanov avatar Dec 18 '23 18:12 ivanov

What about to find the root cause first? :-)

I fully support that, but lack a system that reproduces this error, which is why I ask for help.

What kind of help do you need? I know nothing about jupiter_core, but I can run any suggested patches. I can even root cause a bit, but I need more info about jupiter_core.

For example with test_jupyter_path_user_site: what do you think is wrong? The jupyter_core itself, or the test itself with wrong expectation?

mtelka avatar Dec 18 '23 18:12 mtelka