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

Test failure #1131

Closed
2 tasks done
fabaff opened this issue Jan 28, 2021 · 0 comments · Fixed by #1132
Closed
2 tasks done

Test failure #1131

fabaff opened this issue Jan 28, 2021 · 0 comments · Fixed by #1132

Comments

@fabaff
Copy link

fabaff commented Jan 28, 2021

Checklist

  • The bug is reproducible against the latest release and/or master.
  • There are no similar issues or pull requests to fix it yet.

Describe the bug

Test failure on NixOS and Fedora during the package build process.

============================= test session starts ==============================
platform linux -- Python 3.8.7, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /build/source, configfile: setup.cfg
plugins: asyncio-0.14.0, cov-2.10.1
collected 240 items                                                            
[...]
=================================== FAILURES ===================================
_______________________________ test_debug_html ________________________________

    def test_debug_html():
        async def app(scope, receive, send):
            raise RuntimeError("Something went wrong")

        app = ServerErrorMiddleware(app, debug=True)
        client = TestClient(app, raise_server_exceptions=False)
        response = client.get("/", headers={"Accept": "text/html, */*"})
        assert response.status_code == 500
>       assert response.headers["content-type"].startswith("text/html")

tests/middleware/test_errors.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = {}, key = 'content-type'

    def __getitem__(self, key):
>       return self._store[key.lower()][1]
E       KeyError: 'content-type'

/nix/store/9bb3iygm8kkdzfsaj3j1j2q845nzja1p-python3.8-requests-2.25.0/lib/python3.8/site-packages/requests/structures.py:54: KeyError

Fedora uses different releases

============================= test session starts ==============================
platform linux -- Python 3.9.1, pytest-6.0.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/python-starlette/starlette-0.14.1, configfile: setup.cfg
plugins: cov-2.10.1, asyncio-0.14.0, requests-mock-1.7.0, httpx-0.10.0, mock-3.3.1, benchmark-3.2.3, aresponses-2.0.0, forked-1.3.0, xdist-1.34.0, django-3.8.0, vcr-1.0.2, datafiles-2.0, pyfakefs-3.5.8, httpbin-1.0.0, sugar-0.9.3, aiohttp-0.3.0
collecting ... collected 187 items
[...]

To reproduce

Run with enabled unit tests.

Expected behavior

All tests passing.

Actual behavior

Debugging material

Environment

  • OS: NixOS and Fedora
  • Python version: 3.8.7
  • Starlette version: 0.14.1 but as also present in 0.13.8

Additional context

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