def test_find_julia_py_executable_not_found(monkeypatch): # look in posix_user and standard locations but don't find anything monkeypatch.setattr(sysconfig, "get_scheme_names", lambda: ("posix_user", )) monkeypatch.setattr(sysconfig, "get_path", lambda x, scheme=None: get_path_mock_scheme(scheme)) monkeypatch.setattr(glob, "glob", lambda x: glob_mock()) with pytest.raises(RuntimeError) as excinfo: julia_py_executable() assert "``julia-py`` executable is not found" in str(excinfo.value)
def test_find_julia_py_executable_standard(monkeypatch): # as though we only have standard install available, or didn't find julia-py in any alternate install location monkeypatch.setattr(sysconfig, "get_scheme_names", lambda: ()) monkeypatch.setattr(sysconfig, "get_path", lambda x, scheme=None: get_path_mock_scheme(scheme)) monkeypatch.setattr(glob, "glob", glob_mock) jp = julia_py_executable() assert jp == os.path.join(standard_sample_path, julia_py_with_command_extension())
def test_find_julia_py_executable_by_scheme(monkeypatch): # could extend this to test different kinds of scheme # right now we just fake the "posix_user" scheme and standard scheme, giving two paths to look in monkeypatch.setattr(sysconfig, "get_scheme_names", lambda: ("posix_user", )) monkeypatch.setattr(sysconfig, "get_path", lambda x, scheme=None: get_path_mock_scheme(scheme)) monkeypatch.setattr(glob, "glob", glob_mock) jp = julia_py_executable() assert jp == os.path.join(posix_user_sample_path, julia_py_with_command_extension())