summaryrefslogtreecommitdiff
path: root/tests/test_exceptions.py
diff options
context:
space:
mode:
authorRoberto Bertó <463349+robertoberto@users.noreply.github.com>2026-05-19 02:32:04 +0000
committerRoberto Bertó <463349+robertoberto@users.noreply.github.com>2026-05-19 02:32:04 +0000
commit0f76bcc7179976e893b1d9f296b1b1e7988b0031 (patch)
tree87fa89da92263bbe2af7303a0ab36433fdc6f5d3 /tests/test_exceptions.py
parentffd5ba16eb1ada42a582db4ac8bdaf29f66a868f (diff)
downloadpyvyos-0f76bcc7179976e893b1d9f296b1b1e7988b0031.tar.gz
pyvyos-0f76bcc7179976e893b1d9f296b1b1e7988b0031.zip
refactor: remove unused specs, exceptions, and request_id
The pyvyos.specs Pydantic models were never imported by the runtime and had 0% test coverage. The pyvyos.exceptions hierarchy was defined but never raised anywhere. The request_id helper generated UUIDs that were attached to log records but never propagated to callers — half-implemented tracing is worse than none. This commit does not alter request/response logic or HTTP payloads. It only removes code that was never executed and tests for that code. Removed: - pyvyos/specs/ (Pydantic models package) - pyvyos/exceptions.py (SDKError, HttpError, ApiError, ValidationError) - pyvyos/utils/ids.py (request_id helper) - tests/test_exceptions.py - tests/utils/test_ids.py Edited: - pyvyos/core/rest_client.py: drop request_id import and log extras - pyvyos/utils/__init__.py: drop request_id export Tests: 66 -> 57 passing. Coverage: 54% -> 87%. Public API unchanged.
Diffstat (limited to 'tests/test_exceptions.py')
-rw-r--r--tests/test_exceptions.py51
1 files changed, 0 insertions, 51 deletions
diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py
deleted file mode 100644
index 22a4f34..0000000
--- a/tests/test_exceptions.py
+++ /dev/null
@@ -1,51 +0,0 @@
-"""Tests for pyvyos.exceptions module."""
-
-import pytest
-
-from pyvyos.exceptions import SDKError, HttpError, ApiError, ValidationError
-
-
-def test_sdk_error_base():
- """Test SDKError is base exception."""
- assert issubclass(HttpError, SDKError)
- assert issubclass(ApiError, SDKError)
- assert issubclass(ValidationError, SDKError)
-
-
-def test_http_error():
- """Test HttpError creation and attributes."""
- error = HttpError(status=404, message="Not Found")
- assert error.status == 404
- assert error.message == "Not Found"
- assert "404" in str(error)
- assert "Not Found" in str(error)
-
-
-def test_api_error():
- """Test ApiError creation."""
- error = ApiError(message="API failure")
- assert error.message == "API failure"
- assert "API failure" in str(error)
-
-
-def test_api_error_with_details():
- """Test ApiError with details."""
- details = {"code": "ERR001", "field": "path"}
- error = ApiError(message="Validation failed", details=details)
- assert error.message == "Validation failed"
- assert error.details == details
-
-
-def test_validation_error():
- """Test ValidationError creation."""
- error = ValidationError(message="Invalid path format")
- assert error.message == "Invalid path format"
- assert "Invalid path format" in str(error)
-
-
-def test_exceptions_raiseable():
- """Test that exceptions can be raised and caught."""
- with pytest.raises(HttpError) as exc_info:
- raise HttpError(status=500, message="Internal Error")
- assert exc_info.value.status == 500
-