summaryrefslogtreecommitdiff
path: root/tests/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Use a shared file-system lock in ``create_server`` (#11294)Martin Liška2023-04-061-7/+15
| | | | | | | With parallel run of tests, one gets "Address already in use" errors as all tests attempt to bind to the same port. Fix it with a shared file-system lock. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Speed up ``test_linkcheck``Adam Turner2023-03-241-1/+1
|
* refactor: ssl.wrap_context() has been deprecated nowTakeshi KOMIYA2021-12-111-6/+4
|
* Replace modify_env() with pytest monkeypatch.setenv()Jon Dufresne2020-11-271-16/+0
| | | | | | | The same test utility function is built into pytest. Can avoid the duplication. https://docs.pytest.org/en/latest/monkeypatch.html#monkeypatching-environment-variables
* Unset env variables in tests by del os.environFrançois Freitag2020-11-261-1/+1
| | | | | The `unsetenv()` operation does not update `os.environ`. https://docs.python.org/3/library/os.html#os.unsetenv
* Merge pull request #8436 from francoisfreitag/better-certsTakeshi KOMIYA2020-11-161-1/+2
|\ | | | | linkcheck: Specify subjectAltName in test self-signed certificate
| * linkcheck: Specify subjectAltName in test self-signed certificateFrançois Freitag2020-11-151-1/+2
| | | | | | | | | | | | | | | | | | Clears warning: tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_tls_cacerts tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_requests_env_var …/venv/lib/python3.8/site-packages/urllib3/connection.py:455: SubjectAltNameWarning: Certificate for localhost has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.) warnings.warn(
* | tests: Always cleanup when exiting modify_env context managerFrançois Freitag2020-11-151-6/+8
| | | | | | | | Previously, an exception would leave the environment changed.
* | linkcheck: Prevent REQUESTS_CA_BUNDLE leak in testsFrançois Freitag2020-11-141-0/+14
|/ | | | | | | | | | | Test `test_connect_to_selfsigned_nonexistent_cert_file` serves two purposes: - verify the behavior when the CA bundle file path is incorrect - flag a leak of REQUESTS_CA_BUNDLE Assumes that test runs after `test_connect_to_selfsigned_with_requests_env_var`. Not great, but better than no testing.
* linkcheck: Verify behavior with self-signed certsFrançois Freitag2020-11-141-8/+29
|
* Rewrite test_inspect_main_url to avoid mockingFrançois Freitag2020-11-081-0/+27
Makes the test more realistic by issuing an HTTP request. Reduces coupling between test and the code under test. The `http_server` helper was factored out into a new tests.utils module.