Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ asyncio_default_fixture_loop_scope = "session"
filterwarnings = [
"error"
]
markers = [
"skip_if_strict: skip test if using strict validation (for prism mock server issues)"
]

[tool.pyright]
# this enables practically every flag given by pyright.
Expand Down
8 changes: 8 additions & 0 deletions tests/api_resources/devboxes/test_lsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ def test_path_params_get_code_actions_for_diagnostic(self, client: Runloop) -> N
)

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
def test_method_get_code_segment_info(self, client: Runloop) -> None:
lsp = client.devboxes.lsp.get_code_segment_info(
id="id",
Expand All @@ -594,6 +595,7 @@ def test_method_get_code_segment_info(self, client: Runloop) -> None:
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
def test_method_get_code_segment_info_with_all_params(self, client: Runloop) -> None:
lsp = client.devboxes.lsp.get_code_segment_info(
id="id",
Expand All @@ -604,6 +606,7 @@ def test_method_get_code_segment_info_with_all_params(self, client: Runloop) ->
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
def test_raw_response_get_code_segment_info(self, client: Runloop) -> None:
response = client.devboxes.lsp.with_raw_response.get_code_segment_info(
id="id",
Expand All @@ -617,6 +620,7 @@ def test_raw_response_get_code_segment_info(self, client: Runloop) -> None:
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
def test_streaming_response_get_code_segment_info(self, client: Runloop) -> None:
with client.devboxes.lsp.with_streaming_response.get_code_segment_info(
id="id",
Expand Down Expand Up @@ -1380,6 +1384,7 @@ async def test_path_params_get_code_actions_for_diagnostic(self, async_client: A
)

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
async def test_method_get_code_segment_info(self, async_client: AsyncRunloop) -> None:
lsp = await async_client.devboxes.lsp.get_code_segment_info(
id="id",
Expand All @@ -1389,6 +1394,7 @@ async def test_method_get_code_segment_info(self, async_client: AsyncRunloop) ->
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
async def test_method_get_code_segment_info_with_all_params(self, async_client: AsyncRunloop) -> None:
lsp = await async_client.devboxes.lsp.get_code_segment_info(
id="id",
Expand All @@ -1399,6 +1405,7 @@ async def test_method_get_code_segment_info_with_all_params(self, async_client:
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
async def test_raw_response_get_code_segment_info(self, async_client: AsyncRunloop) -> None:
response = await async_client.devboxes.lsp.with_raw_response.get_code_segment_info(
id="id",
Expand All @@ -1412,6 +1419,7 @@ async def test_raw_response_get_code_segment_info(self, async_client: AsyncRunlo
assert_matches_type(CodeSegmentInfoResponse, lsp, path=["response"])

@parametrize
@pytest.mark.skip_if_strict(reason="prism mock server generates invalid nested DocumentSymbol structures")
async def test_streaming_response_get_code_segment_info(self, async_client: AsyncRunloop) -> None:
async with async_client.devboxes.lsp.with_streaming_response.get_code_segment_info(
id="id",
Expand Down
29 changes: 29 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,35 @@ def pytest_collection_modifyitems(items: list[pytest.Function]) -> None:
if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp":
item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock"))

# Handle skip_if_strict marker
for item in items:
skip_marker = item.get_closest_marker("skip_if_strict")
if not skip_marker:
continue

if not hasattr(item, "callspec"):
continue

# Check if this is a strict validation test (True parameter)
client_param = item.callspec.params.get("client", None)
async_client_param = item.callspec.params.get("async_client", None)

is_strict = False
if client_param is True:
is_strict = True
elif is_dict(async_client_param) and async_client_param.get("strict", True):
is_strict = True
elif async_client_param is True:
is_strict = True

if is_strict:
reason = (
skip_marker.kwargs.get("reason", "Skip strict validation test")
if skip_marker.kwargs
else "Skip strict validation test"
)
item.add_marker(pytest.mark.skip(reason=reason))


base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand Down
Loading