Skip to content

Commit 5cfd630

Browse files
committed
fix: test ci/cd
1 parent 6a8cb6c commit 5cfd630

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

pyproject.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ skip-magic-trailing-comma = false
7070
line-ending = "auto"
7171

7272
[tool.mypy]
73-
plugins = ["pydantic.mypy"]
7473
mypy_path = "src"
7574
explicit_package_bases = true
7675
namespace_packages = true
@@ -82,15 +81,10 @@ check_untyped_defs = true
8281
no_implicit_reexport = true
8382
disallow_untyped_defs = false
8483

85-
[tool.pydantic-mypy]
86-
init_forbid_extra = true
87-
init_typed = true
88-
warn_required_dynamic_aliases = true
89-
9084
[tool.pytest.ini_options]
9185
testpaths = ["tests"]
9286
python_files = "test_*.py"
93-
addopts = "-ra -q --cov=src/uipath --cov-report=term-missing"
87+
addopts = "-ra -q --cov=src/aptabase --cov-report=term-missing"
9488
asyncio_default_fixture_loop_scope = "function"
9589
asyncio_mode = "auto"
9690

src/aptabase/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def __init__(
2828
flush_interval: float = 10.0,
2929
timeout: float = 30.0,
3030
) -> None:
31-
"""
32-
Initialize the Aptabase client.
31+
"""Initialize the Aptabase client.
3332
3433
Args:
3534
app_key: Your Aptabase app key (format: A-{REGION}-{ID})
@@ -63,7 +62,7 @@ def __init__(
6362
self._event_queue: list[Event] = []
6463
self._queue_lock = asyncio.Lock()
6564
self._client: httpx.AsyncClient | None = None
66-
self._flush_task: asyncio.Task | None = None
65+
self._flush_task: asyncio.Task[Any] | None = None
6766
self._session_id: str | None = None
6867

6968
def _get_base_url(self, app_key: str) -> str:
@@ -123,8 +122,7 @@ async def track(
123122
*,
124123
session_id: str | None = None,
125124
) -> None:
126-
"""
127-
Track an analytics event.
125+
"""Track an analytics event.
128126
129127
Args:
130128
event_name: Name of the event to track
@@ -172,6 +170,8 @@ async def _flush_events(self) -> None:
172170

173171
async def _send_events(self, events: list[Event]) -> None:
174172
"""Send events to the Aptabase API."""
173+
assert self._client is not None, "HTTP client is not initialized"
174+
175175
if not events:
176176
return
177177

src/aptabase/exceptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class ConfigurationError(AptabaseError):
1616
class NetworkError(AptabaseError):
1717
"""Raised when network requests fail."""
1818

19-
def __init__(self, message: str, status_code: int = None) -> None:
19+
def __init__(self, message: str, status_code: int | None = None) -> None:
20+
"""Initialize the NetworkError exception."""
2021
super().__init__(message)
2122
self.status_code = status_code
2223

src/aptabase/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class Event:
3939
"""Represents an analytics event to be sent to Aptabase."""
4040

4141
name: str
42-
props: dict[str, Any] | None = None
4342
timestamp: datetime | None = None
4443
session_id: str | None = None
44+
props: dict[str, Any] | None = None
4545

4646
def __post_init__(self) -> None:
4747
"""Set default values after initialization."""
@@ -55,7 +55,7 @@ def __post_init__(self) -> None:
5555
def to_dict(self, system_props: SystemProperties) -> dict[str, Any]:
5656
"""Convert to dictionary format for API requests."""
5757
return {
58-
"timestamp": self.timestamp.isoformat() + "Z",
58+
"timestamp": self.timestamp.isoformat() + "Z" if self.timestamp else None,
5959
"sessionId": self.session_id,
6060
"eventName": self.name,
6161
"systemProps": system_props.to_dict(),

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Test suite for Aptabase Python SDK.
3+
"""

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"""Shared pytest fixtures for all tests."""
2+

tests/test_dummy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
def test_dummy():
4+
assert True

0 commit comments

Comments
 (0)