Habiticalib 0.3.4__tar.gz → 0.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/workflows/build.yml +4 -16
- {habiticalib-0.3.4 → habiticalib-0.3.5}/PKG-INFO +1 -1
- {habiticalib-0.3.4 → habiticalib-0.3.5}/pyproject.toml +3 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/const.py +1 -1
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/types.py +7 -1
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/conftest.py +23 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/test_avatar.py +7 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.cruft.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.editorconfig +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/FUNDING.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/dependabot.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/labels.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/release-drafter.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/workflows/documentation.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/workflows/draft.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.github/workflows/labeler.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.gitignore +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.pre-commit-config.yaml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/.vscode/settings.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/LICENSE +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/README.md +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/docs/index.md +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/docs/reference/habiticalib.md +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/mkdocs.yml +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/__init__.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/exceptions.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/ha.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/helpers.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/lib.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/src/habiticalib/py.typed +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__init__.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar.png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[animated_background].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[default].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[kickstarter_backer_gear].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[kickstarter_pet_mount].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[seafoam].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[shinySeed].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[sleeping].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[snowball].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[special_0].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[special_1].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[spookySparkles].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[weapon_critical].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[with_chair].png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar_to_file.png +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar.ambr +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_login.ambr +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_tasks.ambr +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_user.ambr +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/empty_data.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/login.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/task.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/task_order.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/tasks.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_anonymized.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_animated_background.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_kickstarter.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_kickstarter_pets.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_seafoam.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_shinySeed.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_sleeping.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_snowball.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_special_0.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_special_1.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_spookySparkles.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_weapon_critical.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/fixtures/user_styles_with_chair.json +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/test_login.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/test_tasks.py +0 -0
- {habiticalib-0.3.4 → habiticalib-0.3.5}/tests/test_user.py +0 -0
@@ -4,18 +4,12 @@ on: [push, pull_request]
|
|
4
4
|
|
5
5
|
jobs:
|
6
6
|
test:
|
7
|
-
|
8
|
-
runs-on: ubuntu-latest
|
9
7
|
strategy:
|
10
8
|
matrix:
|
11
|
-
|
12
|
-
|
9
|
+
os: [windows-latest, ubuntu-latest, macos-latest, ubuntu-22.04-arm]
|
10
|
+
runs-on: ${{ matrix.os }}
|
13
11
|
steps:
|
14
12
|
- uses: actions/checkout@v4
|
15
|
-
- name: Set up Python
|
16
|
-
uses: actions/setup-python@v5
|
17
|
-
with:
|
18
|
-
python-version: ${{ matrix.python_version }}
|
19
13
|
- name: Install dependencies
|
20
14
|
run: pipx install hatch
|
21
15
|
- name: Lint and typecheck
|
@@ -23,7 +17,7 @@ jobs:
|
|
23
17
|
hatch run lint-check
|
24
18
|
- name: Test
|
25
19
|
run: |
|
26
|
-
hatch test --all
|
20
|
+
hatch test --all --runslow
|
27
21
|
|
28
22
|
- uses: codecov/codecov-action@v5
|
29
23
|
with:
|
@@ -42,15 +36,9 @@ jobs:
|
|
42
36
|
|
43
37
|
steps:
|
44
38
|
- uses: actions/checkout@v4
|
45
|
-
- name: Set up Python
|
46
|
-
uses: actions/setup-python@v5
|
47
|
-
with:
|
48
|
-
python-version: '3.12'
|
49
39
|
- name: Install dependencies
|
50
40
|
shell: bash
|
51
|
-
run:
|
52
|
-
python -m pip install --upgrade pip
|
53
|
-
pip install hatch
|
41
|
+
run: pipx install hatch
|
54
42
|
- name: mint API token
|
55
43
|
id: mint-token
|
56
44
|
run: |
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: Habiticalib
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.5
|
4
4
|
Summary: Asynchronous Python client library for the Habitica API
|
5
5
|
Project-URL: Documentation, https://tr4nt0r.github.io/habiticalib/
|
6
6
|
Project-URL: Source, https://github.com/tr4nt0r/habiticalib
|
@@ -33,6 +33,9 @@ pythonpath = ["src"]
|
|
33
33
|
addopts = "--cov=src/habiticalib --cov-report=term-missing"
|
34
34
|
asyncio_mode = "auto"
|
35
35
|
asyncio_default_fixture_loop_scope = "function"
|
36
|
+
markers = [
|
37
|
+
"slow: marks test as slow"
|
38
|
+
]
|
36
39
|
|
37
40
|
[tool.pylint.DESIGN]
|
38
41
|
max-attributes = 8
|
@@ -11,6 +11,7 @@ from typing import Any, NotRequired, TypedDict
|
|
11
11
|
from uuid import UUID
|
12
12
|
|
13
13
|
from mashumaro import field_options
|
14
|
+
from mashumaro.config import BaseConfig
|
14
15
|
from mashumaro.mixins.orjson import DataClassORJSONMixin
|
15
16
|
|
16
17
|
|
@@ -907,9 +908,14 @@ class Task(TypedDict("Task", {"type": NotRequired[TaskType]}), total=True):
|
|
907
908
|
|
908
909
|
|
909
910
|
@dataclass(kw_only=True)
|
910
|
-
class TaskData:
|
911
|
+
class TaskData(DataClassORJSONMixin):
|
911
912
|
"""Task data."""
|
912
913
|
|
914
|
+
class Config(BaseConfig):
|
915
|
+
"""Configuration for TaskData."""
|
916
|
+
|
917
|
+
serialize_by_alias = True
|
918
|
+
|
913
919
|
challenge: Challenge = field(default_factory=Challenge)
|
914
920
|
group: GroupTask = field(default_factory=GroupTask)
|
915
921
|
Type: TaskType | None = field(default=None, metadata=field_options(alias="type"))
|
@@ -24,6 +24,29 @@ DEFAULT_HEADERS = {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
|
27
|
+
def pytest_addoption(parser: pytest.Parser) -> None:
|
28
|
+
"""Commandline options."""
|
29
|
+
|
30
|
+
parser.addoption(
|
31
|
+
"--runslow", action="store_true", default=False, help="run slow tests"
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
def pytest_collection_modifyitems(
|
36
|
+
config: pytest.Config,
|
37
|
+
items: list[pytest.Item],
|
38
|
+
) -> None:
|
39
|
+
"""Check for slow items."""
|
40
|
+
if config.getoption("--runslow"):
|
41
|
+
# --runslow given in cli: do not skip slow tests
|
42
|
+
return
|
43
|
+
|
44
|
+
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
|
45
|
+
for item in items:
|
46
|
+
if "slow" in item.keywords:
|
47
|
+
item.add_marker(skip_slow)
|
48
|
+
|
49
|
+
|
27
50
|
@pytest.fixture
|
28
51
|
def api_url() -> URL:
|
29
52
|
"""Return base API URL."""
|
@@ -3,6 +3,7 @@
|
|
3
3
|
import asyncio
|
4
4
|
from io import BytesIO
|
5
5
|
import pathlib
|
6
|
+
import sys
|
6
7
|
|
7
8
|
from aiohttp import ClientSession
|
8
9
|
from aioresponses import aioresponses
|
@@ -16,6 +17,8 @@ from habiticalib.types import UserStyles
|
|
16
17
|
from .conftest import load_fixture
|
17
18
|
|
18
19
|
|
20
|
+
@pytest.mark.skipif(sys.platform != "linux", reason="needs linux")
|
21
|
+
@pytest.mark.slow
|
19
22
|
async def test_generate_avatar(
|
20
23
|
mock_aiohttp: aioresponses,
|
21
24
|
snapshot: SnapshotAssertion,
|
@@ -36,6 +39,8 @@ async def test_generate_avatar(
|
|
36
39
|
assert avatar.getvalue() == snapshot_png
|
37
40
|
|
38
41
|
|
42
|
+
@pytest.mark.skipif(sys.platform != "linux", reason="needs linux")
|
43
|
+
@pytest.mark.slow
|
39
44
|
async def test_generate_avatar_to_file(
|
40
45
|
mock_aiohttp: aioresponses,
|
41
46
|
api_url: URL,
|
@@ -93,6 +98,8 @@ async def test_generate_avatar_to_file(
|
|
93
98
|
],
|
94
99
|
)
|
95
100
|
@pytest.mark.usefixtures("mock_aiohttp")
|
101
|
+
@pytest.mark.skipif(sys.platform != "linux", reason="needs linux")
|
102
|
+
@pytest.mark.slow
|
96
103
|
async def test_generate_avatar_from_styles(
|
97
104
|
snapshot_png: SnapshotAssertion,
|
98
105
|
style_variations: str,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{habiticalib-0.3.4 → habiticalib-0.3.5}/tests/__snapshots__/test_avatar/test_generate_avatar.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|