Skip to content
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

Run tests with Actions #6

Closed
wants to merge 4 commits into from
Closed

Conversation

abitrolly
Copy link
Contributor

@abitrolly abitrolly commented May 2, 2021

They fail on Python 2.7 for some reason, but Python 3 works ok.

https://github.com/abitrolly/requests-lsp/actions/runs/803484208

Failed Python 2 run
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.10.0, pluggy-0.13.1
rootdir: /home/runner/work/requests-lsp/requests-lsp
collected 54 items

tests/test_error.py .....................                                [ 38%]
tests/test_request.py ..................F.F............                  [100%]

=================================== FAILURES ===================================
_ test_build_body_options_with_some_form_data[form0-field1=data1&field2=data2] _

form = {'field1': 'data1', 'field2': 'data2'}
expected_encoded_form = 'field1=data1&field2=data2'

    @pytest.mark.parametrize("form, expected_encoded_form", (
        (
            {"field1": "data1", "field2": "data2"},
            "field1=data1&field2=data2",
        ),
        (
            [("field1", "data1"), ("field2", "data2")],
            "field1=data1&field2=data2",
        ),
        (
            {"field1": "data1", "field2": "datüm"},
            "field1=data1&field2=dat%C3%BCm",
        ),
    ))
    def test_build_body_options_with_some_form_data(form, expected_encoded_form):
        prepared_request = PreparedRequest()
        prepared_request.prepare(
            url="http://somefakeurl",
            method="POST",
            data=form,
        )
        curl_request = CURLRequest(prepared_request)
    
        curl_options = curl_request.build_body_options()
    
>       assert curl_options == ((pycurl.POSTFIELDS, expected_encoded_form),)
E       AssertionError: assert ((10015, 'fie...eld1=data1'),) == ((10015, 'fiel...eld2=data2'),)
E         At index 0 diff: (10015, 'field2=data2&field1=data1') != (10015, 'field1=data1&field2=data2')
E         Use -v to get the full diff

tests/test_request.py:280: AssertionError
_ test_build_body_options_with_some_form_data[form2-field1=data1&field2=dat%C3%BCm] _

form = {'field1': 'data1', 'field2': 'dat\xc3\xbcm'}
expected_encoded_form = 'field1=data1&field2=dat%C3%BCm'

    @pytest.mark.parametrize("form, expected_encoded_form", (
        (
            {"field1": "data1", "field2": "data2"},
            "field1=data1&field2=data2",
        ),
        (
            [("field1", "data1"), ("field2", "data2")],
            "field1=data1&field2=data2",
        ),
        (
            {"field1": "data1", "field2": "datüm"},
            "field1=data1&field2=dat%C3%BCm",
        ),
    ))
    def test_build_body_options_with_some_form_data(form, expected_encoded_form):
        prepared_request = PreparedRequest()
        prepared_request.prepare(
            url="http://somefakeurl",
            method="POST",
            data=form,
        )
        curl_request = CURLRequest(prepared_request)
    
        curl_options = curl_request.build_body_options()
    
>       assert curl_options == ((pycurl.POSTFIELDS, expected_encoded_form),)
E       AssertionError: assert ((10015, 'fie...eld1=data1'),) == ((10015, 'fiel...dat%C3%BCm'),)
E         At index 0 diff: (10015, 'field2=dat%C3%BCm&field1=data1') != (10015, 'field1=data1&field2=dat%C3%BCm')
E         Use -v to get the full diff

tests/test_request.py:280: AssertionError
===================== 2 failed, 52 passed in 0.31 seconds ======================
Error: Process completed with exit code 1.

@abitrolly abitrolly mentioned this pull request May 3, 2021
@paivett
Copy link
Owner

paivett commented May 24, 2021

I have implemented my own actions, running also some integration tests with httpbin service.
Regarding py2 fail, it seems a problem of order of parameters, but I will not support py2.

@paivett paivett closed this May 24, 2021
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

Successfully merging this pull request may close these issues.

2 participants