diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..99177d58 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +tests/sample_file.txt text eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78126790..9cb1370f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,8 +77,12 @@ jobs: test: timeout-minutes: 10 - name: test - runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + name: test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || matrix.os }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -89,7 +93,9 @@ jobs: version: '0.10.2' - name: Bootstrap + shell: bash run: ./scripts/bootstrap - name: Run tests + shell: bash run: ./scripts/test diff --git a/tests/test_client.py b/tests/test_client.py index fd0e7810..be33c515 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -266,7 +266,10 @@ def test_copy_signature(self, client: Stagehand) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + @pytest.mark.skipif( + sys.version_info >= (3, 10) or sys.platform == "win32", + reason="memory leak assertion is not stable on Python >=3.10 or Windows", + ) def test_copy_build_request(self, client: Stagehand) -> None: options = FinalRequestOptions(method="get", url="/foo") @@ -1151,7 +1154,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly - monkeypatch.setenv("HTTPS_PROXY", "https://example.org") # Delete in case our environment has any proxy env vars set monkeypatch.delenv("HTTP_PROXY", raising=False) monkeypatch.delenv("ALL_PROXY", raising=False) @@ -1160,6 +1162,9 @@ def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> N monkeypatch.delenv("https_proxy", raising=False) monkeypatch.delenv("all_proxy", raising=False) monkeypatch.delenv("no_proxy", raising=False) + # Set this last because environment variable names are case-insensitive + # on Windows, so deleting `https_proxy` also deletes `HTTPS_PROXY`. + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") client = DefaultHttpxClient() @@ -1357,7 +1362,10 @@ def test_copy_signature(self, async_client: AsyncStagehand) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + @pytest.mark.skipif( + sys.version_info >= (3, 10) or sys.platform == "win32", + reason="memory leak assertion is not stable on Python >=3.10 or Windows", + ) def test_copy_build_request(self, async_client: AsyncStagehand) -> None: options = FinalRequestOptions(method="get", url="/foo") @@ -2257,7 +2265,6 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly - monkeypatch.setenv("HTTPS_PROXY", "https://example.org") # Delete in case our environment has any proxy env vars set monkeypatch.delenv("HTTP_PROXY", raising=False) monkeypatch.delenv("ALL_PROXY", raising=False) @@ -2266,6 +2273,9 @@ async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch monkeypatch.delenv("https_proxy", raising=False) monkeypatch.delenv("all_proxy", raising=False) monkeypatch.delenv("no_proxy", raising=False) + # Set this last because environment variable names are case-insensitive + # on Windows, so deleting `https_proxy` also deletes `HTTPS_PROXY`. + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") client = DefaultAsyncHttpxClient()