Skip to content

Tests failed #81

@tht2005

Description

@tht2005

I tried pytest tests/ and get some fail tests.

================================================================== test session starts ===================================================================
platform linux -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /mnt/github/glsl2
plugins: asyncio-1.0.0, pkgcore-0.12.30, subtests-0.14.2, typeguard-4.4.4, lsp-0.4.3
asyncio: mode=Mode.STRICT, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 21 items                                                                                                                                       

tests/test_lsp.py ,,,,.,,,,,,,,,,,,,,,,,,,,.,,,,,,,,,,,,.,,,,,,,,,,,,,,u,,,.,,y,y.,,,,,,,,,,,,,.,,,,,,,,.,,,,,,,,.,,,,,,,,,,,,,,,,,,,.,,,,,,...,,, [ 61%]
,,.,,,,y.,,yyy.,,,,,,,..y,.,,,..                                                                                                                   [ 95%]
tests/test_parser.py ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,u,,,,,,. [100%]

======================================================================== FAILURES ========================================================================
______________________________________ test_hover[opened_file3] [hover-and-completion/interface_blocks.geom:72:13] _______________________________________

client = <pytest_lsp.client.LanguageClient object at 0x7fa252c12b10>, opened_file = <testing_utils.OpenedFile object at 0x7fa252abc8a0>
subtests = SubTests(ihook=<_pytest.config.compat.PathAwareHookProxy object at 0x7fa254593e00>, suspend_capture_ctx=<bound method ..._in_suspended=False> _capture_fixture=None>>, request=<SubRequest 'subtests' for <Coroutine test_hover[opened_file3]>>)

    @pytest.mark.asyncio
    async def test_hover(
        client: pytest_lsp.LanguageClient,
        opened_file: OpenedFile,
        subtests: pytest_subtests.SubTests
    ):
    
        for args in opened_file.file.hover_test_args:
            line, column, expected, \
                expect_fail, expect_fail_reason = args
    
            file_location = f"{opened_file}:{line}:{column}"
    
    
            def expect_generic(expected: str, result: lspt.Hover):
    
                result: str = strip_until_naked(result.contents.value)
    
                if not expect_fail:
                    assert result == expected
                else: # expect fail
                    assert result != expected, \
                        f"Expected to fail because: {expect_fail_reason}. Passed instead."
                    pytest.xfail(file_location)
    
    
            def expect_function(expected: str|set[str], result: lspt.Hover):
                def strip_md(mdtext: lspt.MarkupContent) -> list[str]:
    
                    text = strip_until_naked(mdtext.value)
                    entries = text.split(sep="\n")
    
                    return entries
    
    
                result: list[str] = strip_md(result.contents)
    
                expected_set = {expected} if isinstance(expected, str) else expected
                result_set   = set(result)
    
                has_no_duplicates        = len(result_set) == len(result)
                is_expected_overload_set = expected_set == result_set
    
                if not expect_fail:
                    assert has_no_duplicates and is_expected_overload_set
                else:
                    assert not (has_no_duplicates and is_expected_overload_set), \
                        f"Expected to fail because: {expect_fail_reason}. Passed instead."
                    pytest.xfail(file_location)
    
    
    
    
            with subtests.test(msg=file_location):
    
                result = await client.text_document_hover_async(
                    params=lspt.HoverParams(
                        text_document=opened_file.identifier,
                        position=to_zero_based_position(line, column)
                    )
                )
    
                if none_guard(expected, result, expect_fail, expect_fail_reason, file_location):
                    continue
    
                match (expected):
                    case expected_hover.Generic():
>                       expect_generic(expected.expected, result)

tests/test_lsp.py:190: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expected = 'vec4'
result = 'vec4\n```\n\n\n---\n\n```glsl\nvec4 gl_Position;\n```\n\nIn the vertex, tessellation evaluation and geometry language...r-vertex or per-control point inputs whose content represents the corresponding outputs written by the previous stage.'

    def expect_generic(expected: str, result: lspt.Hover):
    
        result: str = strip_until_naked(result.contents.value)
    
        if not expect_fail:
>           assert result == expected
E           AssertionError: assert 'vec4\n```\n\...evious stage.' == 'vec4'
E             
E             - vec4
E             + vec4
E             ?     +
E             + ```
E             + 
E             + ...
E             
E             ...Full output truncated (13 lines hidden), use '-vv' to show

tests/test_lsp.py:142: AssertionError
----------------------------------------------------------------- Captured stderr setup ------------------------------------------------------------------
debug: method: 'initialize'
------------------------------------------------------------------ Captured stderr call ------------------------------------------------------------------
debug: method: 'textDocument/hover'
debug: hover: 71:12 file:///mnt/github/glsl2/tests/hover-and-completion/interface_blocks.geom
------------------------------------------------------------------- Captured log call --------------------------------------------------------------------

---------------------------------------------------------------- Captured stderr teardown ----------------------------------------------------------------
debug: method: 'textDocument/didClose'
debug: closed: file:///mnt/github/glsl2/tests/hover-and-completion/interface_blocks.geom
debug: method: 'shutdown'
_________ test_parser_in_directory[glsl-samples/well-formed/glslang/] [/mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert] _________

subtests = SubTests(ihook=<_pytest.config.compat.PathAwareHookProxy object at 0x7fa254593e00>, suspend_capture_ctx=<bound method ...ure=None>>, request=<SubRequest 'subtests' for <Function test_parser_in_directory[glsl-samples/well-formed/glslang/]>>)
dir_with_test_files = PosixPath('/mnt/github/glsl2/tests/glsl-samples/well-formed/glslang')

    def test_parser_in_directory(
        subtests: pytest_subtests.SubTests,
        dir_with_test_files: Path
    ):
    
        for file in dir_with_test_files.iterdir():
            if file.suffix not in glsl_extensions:
                continue
    
            with subtests.test(msg=str(file)):
                output = subprocess.run(
                    args=("glsl_analyzer", "--parse-file", str(file)),
                    capture_output=True,
                    text=True
                )
    
>               assert output.returncode == 0 and len(output.stderr) == 0, \
                    output.stderr
E               AssertionError: /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:28:21: expected )
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:28:21: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:28:22: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:28:25: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:49:1040: expected )
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:49:1040: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:49:1041: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:49:1046: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:14: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:22: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:22: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:22: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:23: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:24: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:26: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:70:27: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:15: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:23: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:23: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:23: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:24: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:25: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:26: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:71:27: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:15: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:15: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:16: expected an expression
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:16: expected )
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:17: expected an expression
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:18: expected an expression
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:18: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:18: expected }
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:18: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:19: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:20: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:21: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:78:23: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:15: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:23: expected ,
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:23: expected ;
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:23: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:24: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:25: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:26: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:27: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:81:29: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:82:1: expected a declaration
E                 /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:98:4: expected ;
E                 
E               assert (1 == 0)
E                +  where 1 = CompletedProcess(args=('glsl_analyzer', '--parse-file', '/mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/toke...: expected a declaration\n/mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:98:4: expected ;\n').returncode

tests/test_parser.py:41: AssertionError
------------------------------------------------------------------- Captured log call --------------------------------------------------------------------

================================================================ short test summary info =================================================================
[hover-and-completion/interface_blocks.geom:72:13] SUBFAIL tests/test_lsp.py::test_hover[opened_file3] - AssertionError: assert 'vec4\n```\n\...evious stage.' == 'vec4'
[/mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert] SUBFAIL tests/test_parser.py::test_parser_in_directory[glsl-samples/well-formed/glslang/] - AssertionError: /mnt/github/glsl2/tests/glsl-samples/well-formed/glslang/tokenPaste.vert:28:21: expected )
========================================= 2 failed, 21 passed, 291 subtests passed, 7 subtests xfailed in 2.76s ==========================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions