Skip to content

Test conflicts with preinstalled black on the system #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Andrej730 opened this issue Mar 29, 2025 · 1 comment
Open

Test conflicts with preinstalled black on the system #94

Andrej730 opened this issue Mar 29, 2025 · 1 comment

Comments

@Andrej730
Copy link
Contributor

Not sure what's the exact cause but running with black installed on the system makes test fail.

py -m pytest -p no:pytest-blender tests\multilspy\test_multilspy_python.py --capture=no
# tests\multilspy\test_multilspy_python.py::test_multilspy_python_black PASSED
pip install black
py -m pytest -p no:pytest-blender tests\multilspy\test_multilspy_python.py --capture=no
# tests\multilspy\test_multilspy_python.py::test_multilspy_python_black FAILED

Full error:

tests\multilspy\test_multilspy_python.py::test_multilspy_python_black FAILED

================================================================================= FAILURES =================================================================================
_______________________________________________________________________ test_multilspy_python_black ________________________________________________________________________

    @pytest.mark.asyncio
    async def test_multilspy_python_black():
        """
        Test the working of multilspy with python repository - black
        """
        code_language = Language.PYTHON
        params = {
            "code_language": code_language,
            "repo_url": "https://github.com/psf/black/",
            "repo_commit": "f3b50e466969f9142393ec32a4b2a383ffbe5f23"
        }
        with create_test_context(params) as context:
            lsp = LanguageServer.create(context.config, context.logger, context.source_directory)
            assert isinstance(lsp, JediServer)

            # All the communication with the language server must be performed inside the context manager
            # The server process is started when the context manager is entered and is terminated when the context manager is exited.
            # The context manager is an asynchronous context manager, so it must be used with async with.
            async with lsp.start_server():
                result = await lsp.request_definition(str(PurePath("src/black/mode.py")), 163, 4)

                assert isinstance(result, list)
                assert len(result) == 1
                item = result[0]
                assert item["relativePath"] == str(PurePath("src/black/mode.py"))
                assert item["range"] == {
                    "start": {"line": 163, "character": 4},
                    "end": {"line": 163, "character": 20},
                }
                result = await lsp.request_references(str(PurePath("src/black/mode.py")), 163, 4)

                assert isinstance(result, list)
>               assert len(result) == 8
E               AssertionError: assert 1 == 8
E                +  where 1 = len([{'absolutePath': '.multilspy\\451905597f9045e08699f99b582e63f0\\black-f3b50e466969f9142393ec32a4b2a383ffbe5f23\\src\\black\\mode.py', 'range': {'end': {'character': 20, 'line': 163}, 'start': {'character': 4, 'line': 163}}, 'relativePath': 'src\\black\\mode.py', 'uri': 'file:///c:/.multilspy/451905597f9045e08699f99b582e63f0/black-f3b50e466969f9142393ec32a4b2a383ffbe5f23/src/black/mode.py'}])

tests\multilspy\test_multilspy_python.py:46: AssertionError
---------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
INFO     multilspy:multilspy_logger.py:56 {"time": "2025-03-29 11:21:21", "level": "INFO", "caller_file": "multilspy\\tests\\..\\src\\multilspy\\language_servers\\jedi_language_server\\jedi_server.py", "caller_name": "start_server", "caller_line": 99, "message": "Starting jedi-language-server server process"}
INFO     multilspy:multilspy_logger.py:56 {"time": "2025-03-29 11:21:21", "level": "INFO", "caller_file": "multilspy\\tests\\..\\src\\multilspy\\language_servers\\jedi_language_server\\jedi_server.py", "caller_name": "start_server", "caller_line": 103, "message": "Sending initialize request from LSP client to LSP server and awaiting response"}
========================================================================= short test summary info ==========================================================================
FAILED tests\multilspy\test_multilspy_python.py::test_multilspy_python_black - AssertionError: assert 1 == 8
@LakshyAAAgrawal
Copy link
Collaborator

Can you confirm if this same behaviour is observed even with the pyright language server? This is very interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants