pytest-plugins 0.3.6__tar.gz → 0.3.7__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.
- {pytest_plugins-0.3.6/pytest_plugins.egg-info → pytest_plugins-0.3.7}/PKG-INFO +1 -1
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/utils/helper.py +15 -6
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7/pytest_plugins.egg-info}/PKG-INFO +1 -1
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/setup.py +1 -1
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/LICENSE +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/MANIFEST.in +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/README.md +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pyproject.toml +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/__init__.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/add_config_parameters.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/better_report.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/fail2skip.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/max_fail_streak.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/__init__.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/base_class_test.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/environment_data.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/execution_data.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/status.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/models/test_data.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/utils/__init__.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/utils/create_report.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/utils/pytest_helper.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins/verbose_param_ids.py +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins.egg-info/SOURCES.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins.egg-info/dependency_links.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins.egg-info/entry_points.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins.egg-info/requires.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/pytest_plugins.egg-info/top_level.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/requirements.txt +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/setup.cfg +0 -0
- {pytest_plugins-0.3.6 → pytest_plugins-0.3.7}/tests/test_dummy.py +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
3
|
from dataclasses import is_dataclass
|
|
4
|
+
from datetime import datetime, date, time
|
|
5
|
+
from decimal import Decimal
|
|
4
6
|
from enum import Enum, StrEnum
|
|
5
7
|
from pathlib import Path
|
|
6
8
|
|
|
@@ -14,17 +16,24 @@ def get_project_root(marker: str = ".git") -> Path | None:
|
|
|
14
16
|
return None
|
|
15
17
|
|
|
16
18
|
|
|
17
|
-
def
|
|
18
|
-
if isinstance(obj, (Enum, StrEnum)):
|
|
19
|
-
return obj.value
|
|
20
|
-
if is_dataclass(obj):
|
|
21
|
-
return obj.__dict__
|
|
19
|
+
def default_serialize(obj: object) -> object:
|
|
22
20
|
if isinstance(obj, type):
|
|
23
21
|
return obj.__name__
|
|
22
|
+
if is_dataclass(obj) and not isinstance(obj, type):
|
|
23
|
+
return obj.__dict__
|
|
24
|
+
if isinstance(obj, Enum):
|
|
25
|
+
return obj.value
|
|
26
|
+
if isinstance(obj, set):
|
|
27
|
+
return list(obj)
|
|
28
|
+
if isinstance(obj, tuple):
|
|
29
|
+
return list(obj)
|
|
30
|
+
if isinstance(obj, (datetime, date, time)):
|
|
31
|
+
return obj.isoformat()
|
|
32
|
+
if isinstance(obj, Decimal):
|
|
33
|
+
return float(obj)
|
|
24
34
|
logger.error(f'Object is not serializable: {obj}')
|
|
25
35
|
raise TypeError(f"Type {type(obj)} not serializable")
|
|
26
36
|
|
|
27
|
-
|
|
28
37
|
def open_json(path: Path) -> dict:
|
|
29
38
|
with open(path, 'r', encoding='utf-8') as json_file:
|
|
30
39
|
return json.load(json_file)
|
|
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
|