Giter Site home page Giter Site logo

Comments (3)

kloczek avatar kloczek commented on June 12, 2024

I've tested as well 2.31.0 + current master (a5a0e4b) and it fails as well

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' tests
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/requests-2.31.0
configfile: pyproject.toml
plugins: httpbin-2.0.0, mock-3.12.0
collected 597 items

tests/test_help.py ...                                                   [  0%]
tests/test_hooks.py ...                                                  [  1%]
tests/test_lowlevel.py ....................                              [  4%]
tests/test_packages.py ...                                               [  4%]
tests/test_requests.py ................................................. [ 13%]
......................................................................Fpytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)
attempting to ignore so the rest of the tests can run
. [ 25%]
........................................................................ [ 37%]
.....................................x.................................. [ 49%]
.........................................................                [ 58%]
tests/test_structures.py ....................                            [ 62%]
tests/test_testserver.py ......s....                                     [ 63%]
tests/test_utils.py ..s................................................. [ 72%]
...........................F............................................ [ 84%]
........................................................................ [ 96%]
...sssssssssss.....                                                      [100%]

=================================== FAILURES ===================================
_______________________ TestRequests.test_https_warnings _______________________

self = <tests.test_requests.TestRequests object at 0x7fe947698190>
nosan_server = ('localhost', 37739, '/tmp/pytest-of-tkloczko/pytest-152/certs0/ca.pem')

    @pytest.mark.skipif(
        SNIMissingWarning is None,
        reason="urllib3 2.0 removed that warning and errors out instead",
    )
    def test_https_warnings(self, nosan_server):
        """warnings are emitted with requests.get"""
        host, port, ca_bundle = nosan_server
        if HAS_MODERN_SSL or HAS_PYOPENSSL:
            warnings_expected = ("SubjectAltNameWarning",)
        else:
            warnings_expected = (
                "SNIMissingWarning",
                "InsecurePlatformWarning",
                "SubjectAltNameWarning",
            )

>       with pytest.warns(None) as warning_records:

tests/test_requests.py:1004:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Optional[
            Union[Type[Warning], Tuple[Type[Warning], ...]]
        ] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)

        msg = "exceptions must be derived from Warning, not %s"
        if expected_warning is None:
>           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
E           See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.

/usr/lib/python3.8/site-packages/_pytest/recwarn.py:279: PytestRemovedIn8Warning
______________ TestExtractZippedPaths.test_zipped_paths_extracted ______________

self = <tests.test_utils.TestExtractZippedPaths object at 0x7fe947ef9940>
tmpdir = local('/tmp/pytest-of-tkloczko/pytest-152/test_zipped_paths_extracted0')

    def test_zipped_paths_extracted(self, tmpdir):
        zipped_py = tmpdir.join("test.zip")
        with zipfile.ZipFile(zipped_py.strpath, "w") as f:
            f.write(__file__)

        _, name = os.path.splitdrive(__file__)
        zipped_path = os.path.join(zipped_py.strpath, name.lstrip(r"\/"))
        extracted_path = extract_zipped_paths(zipped_path)

        assert extracted_path != zipped_path
        assert os.path.exists(extracted_path)
>       assert filecmp.cmp(extracted_path, __file__)
E       AssertionError: assert False
E        +  where False = <function cmp at 0x7fe947738940>('/tmp/test_utils.py', '/home/tkloczko/rpmbuild/BUILD/requests-2.31.0/tests/test_utils.py')
E        +    where <function cmp at 0x7fe947738940> = filecmp.cmp

tests/test_utils.py:337: AssertionError
================================== XFAILURES ===================================
_______________ TestRequests.test_response_iter_lines_reentrant ________________

self = <tests.test_requests.TestRequests object at 0x7fe947797880>
httpbin = <function prepare_url.<locals>.inner at 0x7fe9478564c0>

    @pytest.mark.xfail
    def test_response_iter_lines_reentrant(self, httpbin):
        """Response.iter_lines() is not reentrant safe"""
        r = requests.get(httpbin("stream/4"), stream=True)
        assert r.status_code == 200

        next(r.iter_lines())
>       assert len(list(r.iter_lines())) == 3
E       assert 2 == 3
E        +  where 2 = len([b'"http://127.0.0.1:36813/stream/4", "args": {}, "headers": {"Host": "127.0.0.1:36813", "User-Agent": "python-request..."Accept-Encoding": "gzip, deflate, br", "Accept": "*/*", "Connection": "keep-alive"}, "origin": "127.0.0.1", "id": 3}'])
E        +    where [b'"http://127.0.0.1:36813/stream/4", "args": {}, "headers": {"Host": "127.0.0.1:36813", "User-Agent": "python-request..."Accept-Encoding": "gzip, deflate, br", "Accept": "*/*", "Connection": "keep-alive"}, "origin": "127.0.0.1", "id": 3}'] = list(<generator object Response.iter_lines at 0x7fe94788f040>)
E        +      where <generator object Response.iter_lines at 0x7fe94788f040> = <bound method Response.iter_lines of <Response [200]>>()
E        +        where <bound method Response.iter_lines of <Response [200]>> = <Response [200]>.iter_lines

tests/test_requests.py:2093: AssertionError
----------------------------- Captured stderr call -----------------------------
127.0.0.1 - - [14/Feb/2024 22:52:05] "GET /stream/4 HTTP/1.1" 200 1008
=============================== warnings summary ===============================
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (42) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
tests/test_requests.py::TestRequests::test_set_basicauth[42-42]
  /home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'int'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages/requests/auth.py:36: DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
tests/test_requests.py::TestRequests::test_set_basicauth[None-None]
  /home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages/requests/auth.py:46: DeprecationWarning: Non-string passwords will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (<class 'NoneType'>) to a string or bytes object in the near future to avoid problems.
    warnings.warn(

tests/test_utils.py::TestContentEncodingDetection::test_none
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta charset="UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8">]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />]
tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<?xml version="1.0" encoding="UTF-8"?>]
tests/test_utils.py::TestContentEncodingDetection::test_precedence
  /home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.31.0-4.fc35.x86_64/usr/lib/python3.8/site-packages/requests/utils.py:489: DeprecationWarning: In requests 3.0, get_encodings_from_content will be removed. For more information, please see the discussion on issue #2266. (This warning should only appear once.)
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
SKIPPED [1] tests/test_testserver.py:94: this fails non-deterministically under pytest-xdist
SKIPPED [1] tests/test_utils.py:50: condition: cStringIO is None
SKIPPED [10] tests/test_utils.py:815: Test only on Windows
SKIPPED [1] tests/test_utils.py:868: Test only on Windows
XFAIL tests/test_requests.py::TestRequests::test_response_iter_lines_reentrant
FAILED tests/test_requests.py::TestRequests::test_https_warnings - pytest.Pyt...
FAILED tests/test_utils.py::TestExtractZippedPaths::test_zipped_paths_extracted
= 2 failed, 581 passed, 13 skipped, 1 xfailed, 14 warnings in 78.67s (0:01:18) =
127.0.0.1 - - [14/Feb/2024 22:51:58] "GET /relative-redirect/45 HTTP/1.1" 302 0
127.0.0.1 - - [14/Feb/2024 22:51:58] "GET /cookies HTTP/1.1" 200 40
127.0.0.1 - - [14/Feb/2024 22:51:58] "HEAD /get HTTP/1.1" 200 0
127.0.0.1 - - [14/Feb/2024 22:52:02] "GET /get HTTP/1.1" 200 313
127.0.0.1 - - [14/Feb/2024 22:52:03] "GET /get?f%C3%B8%C3%B8=f%C3%B8%C3%B8 HTTP/1.1" 200 340
127.0.0.1 - - [14/Feb/2024 22:52:03] "GET /get?foo=foo HTTP/1.1" 200 300
127.0.0.1 - - [14/Feb/2024 22:52:04] "GET /get HTTP/1.1" 200 272
127.0.0.1 - - [14/Feb/2024 22:52:05] "GET /get HTTP/1.1" 200 272

from requests.

nateprewitt avatar nateprewitt commented on June 12, 2024

The issue is originating from your upgrading outside of our currently defined testing infrastructure requirements. We do not currently support pytest 8.0.0 which is the source of your test failures. Please run the tests with the prescribed requirements, otherwise this will be addressed when support for pytest 8.0 is added.

from requests.

kloczek avatar kloczek commented on June 12, 2024

If it is issue related to use pytest 8.x IMO better would be keep this ticket opened with only renamed subject as sooner or later move to pytest 8 needs to be done.

from requests.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.