-
-
Notifications
You must be signed in to change notification settings - Fork 831
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
tests: fix win32 #3172
base: master
Are you sure you want to change the base?
tests: fix win32 #3172
Changes from all commits
2f7c3e0
c8ac263
2a088f6
5245281
6d8d209
d339b4d
8974fec
70b292a
131d16e
31bef46
3794723
ff66c06
6743d78
dd48883
5d39f62
482e7ac
780cd99
583c786
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,18 @@ on: | |
pull_request: | ||
branches: ["master"] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
tests: | ||
name: "Python ${{ matrix.python-version }}" | ||
runs-on: "ubuntu-latest" | ||
name: "Python ${{ matrix.python-version }} (${{ matrix.os }})" | ||
runs-on: "${{ matrix.os }}-latest" | ||
|
||
strategy: | ||
matrix: | ||
os: ["ubuntu", "windows"] | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
steps: | ||
|
@@ -32,3 +37,4 @@ jobs: | |
run: "scripts/test" | ||
- name: "Enforce coverage" | ||
run: "scripts/coverage" | ||
if: "matrix.os == 'ubuntu'" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably don't need this conditional once we've fixed up all the tests to pass okay on windows, right? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import sys | ||
|
||
import pytest | ||
|
||
import httpx | ||
|
@@ -12,6 +14,9 @@ async def test_read_timeout(server): | |
await client.get(server.url.copy_with(path="/slow_response")) | ||
|
||
|
||
@pytest.mark.skipif( | ||
sys.platform == "win32", reason="time related tests are flaky on win32" | ||
) | ||
Comment on lines
+17
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume we could drop this, and this particular test would actually pass okay on windows? (Also, I think we might want to raise a related refactoring issue to remove these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test may pass on windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's a time accuracy problem on windows. we could increase sleep time in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wrong about this, looks like increase sleep time in /slow_response won't help testing write timeout |
||
@pytest.mark.anyio | ||
async def test_write_timeout(server): | ||
timeout = httpx.Timeout(None, write=1e-6) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
import logging | ||
import os | ||
import random | ||
import sys | ||
|
||
import certifi | ||
import pytest | ||
|
@@ -122,6 +123,7 @@ def test_logging_redirect_chain(server, caplog): | |
] | ||
|
||
|
||
@pytest.mark.skipif(sys.platform == "win32", reason="os path sep escaped on windows") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we still need this skipif because path seprator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
def test_logging_ssl(caplog): | ||
caplog.set_level(logging.DEBUG) | ||
with httpx.Client(): | ||
|
@@ -155,7 +157,9 @@ def test_get_ssl_cert_file(): | |
os.environ["SSL_CERT_FILE"] = str(TESTS_DIR / "test_utils.py") | ||
# SSL_CERT_FILE is correctly set, SSL_CERT_DIR is not set. | ||
ca_bundle = get_ca_bundle_from_env() | ||
assert ca_bundle is not None and ca_bundle.endswith("tests/test_utils.py") | ||
assert ca_bundle is not None and ca_bundle.endswith( | ||
os.path.join("tests", "test_utils.py") | ||
) | ||
|
||
os.environ["SSL_CERT_FILE"] = "wrongfile" | ||
# SSL_CERT_FILE is set with wrong file, SSL_CERT_DIR is not set. | ||
|
@@ -170,7 +174,9 @@ def test_get_ssl_cert_file(): | |
os.environ["SSL_CERT_FILE"] = str(TESTS_DIR / "test_utils.py") | ||
# Two environments is correctly set. | ||
ca_bundle = get_ca_bundle_from_env() | ||
assert ca_bundle is not None and ca_bundle.endswith("tests/test_utils.py") | ||
assert ca_bundle is not None and ca_bundle.endswith( | ||
os.path.join("tests", "test_utils.py") | ||
) | ||
|
||
os.environ["SSL_CERT_FILE"] = "wrongfile" | ||
# Two environments is set but SSL_CERT_FILE is not a file. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure - I'm pleased to see us fix the test cases up for supporting windows, tho do we want to double the time our test runs take to complete?