[Bug]: TestSearch.test_chars_valid test failure

Đang mở
#855 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

Start by running the reproduction commands in a clean environment and inspect tests/unit/templating/test_templating_util.py, especially TestSearch.test_chars_valid. Compare the failing parameterized case with the passing cases and verify the complete pytest suite succeeds with the expected named result.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

kind/bug
Actual Behavior

Test failed

Expected Behavior

Test succeeds

Steps to Reproduce

Try to run the tests using ...

python3 -m venv --clear --system-site-packages testenv
testenv/bin/python3 -m installer dist/*.whl
testenv/bin/python3 -m pytest
OpenAPI Core Version

0.19.2

OpenAPI Core Integration

No integration

Affected Area(s)

testing

References

No response

Anything else we need to know?

Please let me know if I am doing anything drastically wrong here, but I expect this to just work. Any help is greatly appreciated. :)

The tests worked fine with 0.19.1, the code for building the package on Alpine (and running the test suite) is here: https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/testing/py3-openapi-core/APKBUILD

The test environment is a clean Alpine Linux docker container with these additional packages:

py3-isodate-pyc (0.6.1-r5)
py3-isodate (0.6.1-r5)
py3-more-itertools-pyc (10.2.0-r1)
py3-more-itertools (10.2.0-r1)
py3-openapi-spec-validator-pyc (0.7.1-r0)
py3-openapi-spec-validator (0.7.1-r0)
py3-jsonschema-path-pyc (0.3.2-r0)
py3-jsonschema-path (0.3.2-r0)
py3-pathable-pyc (0.4.3-r0)
py3-pathable (0.4.3-r0)
py3-openapi-schema-validator-pyc (0.6.2-r0)
py3-openapi-schema-validator (0.6.2-r0)
py3-jsonschema-pyc (4.22.0-r0)
py3-jsonschema (4.22.0-r0)
py3-jsonschema-specifications-pyc (2023.12.1-r1)
py3-jsonschema-specifications (2023.12.1-r1)
py3-referencing-pyc (0.35.1-r0)
py3-referencing (0.35.1-r0)
py3-rpds-py-pyc (0.18.1_git20240605-r0)
py3-rpds-py (0.18.1_git20240605-r0)
py3-rfc3339-validator-pyc (0.1.4-r0)
py3-rfc3339-validator (0.1.4-r0)
py3-six-pyc (1.16.0-r9)
py3-six (1.16.0-r9)
py3-lazy-object-proxy-pyc (1.10.0-r1)
py3-lazy-object-proxy (1.10.0-r1)
py3-parse-pyc (1.20.0-r1)
py3-parse (1.20.0-r1)
py3-gpep517-pyc (16-r0)
py3-gpep517 (16-r0)
py3-installer-pyc (0.7.0-r2)
py3-installer (0.7.0-r2)
py3-setuptools-pyc (70.0.0-r0)
py3-setuptools (70.0.0-r0)
py3-wheel-pyc (0.42.0-r1)
py3-wheel (0.42.0-r1)
py3-poetry-core-pyc (1.9.0-r0)
py3-poetry-core (1.9.0-r0)
py3-fastjsonschema-pyc (2.20.0-r0)
py3-fastjsonschema (2.20.0-r0)
py3-lark-parser-pyc (1.1.9-r1)
py3-lark-parser (1.1.9-r1)
py3-pytest-aiohttp-pyc (1.0.5-r3)
py3-pytest-aiohttp (1.0.5-r3)
py3-pytest-asyncio-pyc (0.23.6-r0)
py3-pytest-asyncio (0.23.6-r0)
py3-pytest-pyc (8.2.2-r0)
py3-pytest (8.2.2-r0)
py3-iniconfig-pyc (2.0.0-r1)
py3-iniconfig (2.0.0-r1)
py3-packaging-pyc (24.1-r0)
py3-packaging (24.1-r0)
py3-parsing-pyc (3.1.2-r1)
py3-parsing (3.1.2-r1)
py3-pluggy-pyc (1.5.0-r0)
py3-pluggy (1.5.0-r0)
py3-py-pyc (1.11.0-r3)
py3-py (1.11.0-r3)
py3-aiohttp-pyc (3.9.3-r1)
py3-aiohttp (3.9.3-r1)
py3-aiosignal-pyc (1.3.1-r3)
py3-aiosignal (1.3.1-r3)
py3-frozenlist-pyc (1.4.1-r1)
py3-frozenlist (1.4.1-r1)
py3-async-timeout-pyc (4.0.3-r1)
py3-async-timeout (4.0.3-r1)
py3-attrs-pyc (23.2.0-r1)
py3-attrs (23.2.0-r1)
py3-brotli-pyc (1.1.0-r2)
py3-brotli (1.1.0-r2)
py3-idna-ssl-pyc (1.1.0-r9)
py3-idna-ssl (1.1.0-r9)
py3-yarl-pyc (1.9.4-r1)
py3-yarl (1.9.4-r1)
py3-django-rest-framework-pyc (3.15.1-r2)
py3-django-rest-framework (3.15.1-r2)
py3-django-pyc (4.2.12-r0)
py3-django (4.2.12-r0)
py3-asgiref-pyc (3.8.1-r1)
py3-asgiref (3.8.1-r1)
py3-sqlparse-pyc (0.4.4-r2)
py3-sqlparse (0.4.4-r2)
tzdata (2024a-r1)
py3-tz-pyc (2024.1-r1)
py3-tz (2024.1-r1)
py3-fastapi-pyc (0.111.0-r0)
py3-fastapi (0.111.0-r0)
py3-pydantic-pyc (2.6.4-r1)
py3-pydantic (2.6.4-r1)
py3-annotated-types-pyc (0.7.0-r0)
py3-annotated-types (0.7.0-r0)
py3-pydantic-core-pyc (2.16.3-r1)
py3-pydantic-core (2.16.3-r1)
py3-typing-extensions-pyc (4.11.0-r1)
py3-typing-extensions (4.11.0-r1)
py3-flask-pyc (3.0.3-r0)
py3-flask (3.0.3-r0)
py3-blinker-pyc (1.7.0-r1)
py3-blinker (1.7.0-r1)
py3-click-pyc (8.1.7-r2)
py3-click (8.1.7-r2)
py3-itsdangerous-pyc (2.1.2-r4)
py3-itsdangerous (2.1.2-r4)
py3-jinja2-pyc (3.1.4-r0)
py3-jinja2 (3.1.4-r0)
py3-werkzeug-pyc (3.0.3-r0)
py3-werkzeug (3.0.3-r0)
py3-markupsafe-pyc (2.1.5-r1)
py3-markupsafe (2.1.5-r1)
py3-httpx-pyc (0.27.0-r1)
py3-httpx (0.27.0-r1)
py3-httpcore-pyc (1.0.4-r1)
py3-httpcore (1.0.4-r1)
py3-h11-pyc (0.14.0-r4)
py3-h11 (0.14.0-r4)
py3-multidict-pyc (6.0.5-r1)
py3-multidict (6.0.5-r1)
py3-responses-pyc (0.25.0-r1)
py3-responses (0.25.0-r1)
py3-toml-pyc (0.10.2-r7)
py3-toml (0.10.2-r7)
py3-yaml-pyc (6.0.1-r3)
py3-yaml (6.0.1-r3)
py3-starlette-pyc (0.37.2-r2)
py3-starlette (0.37.2-r2)
py3-anyio-pyc (4.3.0-r2)
py3-anyio (4.3.0-r2)
py3-sniffio-pyc (1.3.1-r1)
py3-sniffio (1.3.1-r1)
py3-curio-pyc (1.6-r2)
py3-curio (1.6-r2)
ccache (4.9.1-r0)
hiredis (1.2.0-r0)
yaml (0.2.5-r2)

Test output:

                                                                 
================================================================ FAILURES =================================================================
_________________________________________ TestSearch.test_chars_valid[/{test-id}/test-expected2] __________________________________________
                                                                     
self = <test_templating_util.TestSearch object at 0x7a1665bd8290>, path_pattern = '/{test-id}/test', expected = {'test-id': 'test'}
                                                                     
    @pytest.mark.parametrize(                                        
        "path_pattern,expected",                                     
        [                                                            
            ("/{test_id}/test", {"test_id": "test"}),
            ("/{test.id}/test", {"test.id": "test"}),
            ("/{test-id}/test", {"test-id": "test"}),
        ],                                                           
    )                                                                
    def test_chars_valid(self, path_pattern, expected):
        full_url_pattern = "/test/test"        
                                                                     
        result = search(path_pattern, full_url_pattern)
                                                                     
>       assert result.named == expected       
E       AttributeError: 'NoneType' object has no attribute 'named'
                                                                     
expected   = {'test-id': 'test'}                                     
full_url_pattern = '/test/test'                                      
path_pattern = '/{test-id}/test'                                     
result     = None                                                    
self       = <test_templating_util.TestSearch object at 0x7a1665bd8290>
                                                                     
tests/unit/templating/test_templating_util.py:40: AttributeError
-------------- generated xml file: /home/buildozer/aports/testing/py3-openapi-core/src/openapi-core-0.19.2/reports/junit.xml --------------
========================================================= short test summary info =========================================================
FAILED tests/unit/templating/test_templating_util.py::TestSearch::test_chars_valid[/{test-id}/test-expected2] - AttributeError: 'NoneType' 

Test is run like this:

        python3 -m venv --clear --system-site-packages testenv
        testenv/bin/python3 -m installer dist/*.whl
        testenv/bin/python3 -m pytest
Would you like to implement a fix?

No

Ngôn ngữ chính
Python
Star
368
Fork
140
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-openapi/openapi-core

Tất cả issue của python-openapi/openapi-core

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.