From 09019dfc2896139e10e5507f5f93548e91e9f298 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Thu, 12 Nov 2026 09:53:10 -0500 Subject: [PATCH] test: disable the PyPI version check in tests On a release version the background version check races httpretty's shared fake-socket state and can corrupt a mocked request body, which made test_deploy_bundle fail intermittently. Co-Authored-By: Claude Opus 5.5 --- tests/conftest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index b85d8e6f..f551df8e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import os import sys from typing import Iterator from unittest import mock @@ -46,3 +47,15 @@ def oauth_refresh_lock_in_tmp(tmp_path_factory: pytest.TempPathFactory) -> Itera path = str(tmp_path_factory.getbasetemp() / "oauth-refresh.lock") with mock.patch("rsconnect.oauth._refresh_lock_path", return_value=path): yield + + +@pytest.fixture(autouse=True) +def no_version_check() -> Iterator[None]: + """Keep the background PyPI version check out of tests. + + On a release version the check runs in a thread during every deploy, and + httpretty's fake sockets share sent data across threads, so its PyPI request + can replace the body of a mocked request. `test_version_check.py` re-enables it. + """ + with mock.patch.dict(os.environ, {"RSCONNECT_DISABLE_VERSION_CHECK": "1"}): + yield