pytest-json-ctrf 0.3.7__tar.gz → 0.5.0__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.
Files changed (18) hide show
  1. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/PKG-INFO +6 -2
  2. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/README.md +4 -0
  3. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/Report.py +3 -3
  4. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/TestObject.py +16 -16
  5. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pyproject.toml +8 -2
  6. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/PKG-INFO +6 -2
  7. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/tests/test_plugin.py +4 -4
  8. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/BaseMetadataReport.py +0 -0
  9. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/CommonTestReportPlugin.py +0 -0
  10. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/__init__.py +0 -0
  11. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/ctrf/main.py +0 -0
  12. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/SOURCES.txt +0 -0
  13. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/dependency_links.txt +0 -0
  14. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/entry_points.txt +0 -0
  15. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/requires.txt +0 -0
  16. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/pytest_json_ctrf.egg-info/top_level.txt +0 -0
  17. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/setup.cfg +0 -0
  18. {pytest_json_ctrf-0.3.7 → pytest_json_ctrf-0.5.0}/tests/test_example.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.3.7
3
+ Version: 0.5.0
4
4
  Summary: Pytest plugin to generate json report in CTRF (Common Test Report Format)
5
5
  Author: Oleksii Ostapov
6
6
  Project-URL: Infopulse, https://infopulse.com/
@@ -9,7 +9,7 @@ Classifier: Framework :: Pytest
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
12
+ Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  Requires-Dist: pytest>6.0.0
15
15
 
@@ -110,6 +110,10 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
110
110
  - https://github.com/testomatio/pytestomatio -> Source of inspiration for creating pytest plugins
111
111
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
112
112
 
113
+ ## Changelog
114
+ - 0.5.0 - Changed logic of handling parametrized tests. Previously they were marked as retries, now they are reported as separate tests
115
+ - 0.4.1 - Introduced backward compatibility with python 3.8, fixed issues with the time formats
116
+
113
117
  ### Roadmap
114
118
  - Add screenshots handling
115
119
  - Add hooks for the report extension
@@ -95,6 +95,10 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
95
95
  - https://github.com/testomatio/pytestomatio -> Source of inspiration for creating pytest plugins
96
96
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
97
97
 
98
+ ## Changelog
99
+ - 0.5.0 - Changed logic of handling parametrized tests. Previously they were marked as retries, now they are reported as separate tests
100
+ - 0.4.1 - Introduced backward compatibility with python 3.8, fixed issues with the time formats
101
+
98
102
  ### Roadmap
99
103
  - Add screenshots handling
100
104
  - Add hooks for the report extension
@@ -16,10 +16,10 @@ class Report:
16
16
  self.stop_time = None
17
17
 
18
18
  def start(self) -> None:
19
- self.start_time = self.start_time = int(time.time() * 1000)
19
+ self.start_time = int(time.time() * 1000)
20
20
 
21
21
  def stop(self) -> None:
22
- self.stop_time = self.start_time = int(time.time() * 1000)
22
+ self.stop_time = int(time.time() * 1000)
23
23
 
24
24
  @staticmethod
25
25
  def _get_tool() -> dict:
@@ -62,7 +62,7 @@ class Report:
62
62
 
63
63
  def process_retries(self) -> None:
64
64
  for test_id, test_data in self.test_items.items():
65
- name = test_id.split('[')[0]
65
+ name = str(test_id)
66
66
  test: Optional[TestObject] = self.prepared_tests.get(name)
67
67
  if test:
68
68
  test.status = test_data.status
@@ -1,5 +1,5 @@
1
1
  from enum import Enum
2
- from typing import Any
2
+ from typing import Any, Optional, List, Dict
3
3
 
4
4
  from pytest import TestReport
5
5
 
@@ -15,20 +15,20 @@ class TestStatus(Enum):
15
15
  class TestObject:
16
16
  name: str
17
17
  _status: TestStatus
18
- raw_status: str
19
- duration: float = 0
20
- start: float
21
- stop: float
18
+ raw_status: Optional[str]
19
+ duration: int = 0
20
+ start: int
21
+ stop: int
22
22
  retries: int
23
- message: str
23
+ message: Optional[str]
24
24
 
25
- worker_id: str
25
+ worker_id: Optional[str]
26
26
  file_path: str
27
- tags: list[str]
28
- browser: str
29
- trace: str
27
+ tags: List[str]
28
+ browser: Optional[str]
29
+ trace: Optional[str]
30
30
 
31
- def __init__(self, report: TestReport, worker_id: str or None = None):
31
+ def __init__(self, report: TestReport, worker_id: Optional[str] = None):
32
32
  self.name = report.nodeid.split('[')[0]
33
33
  self._status = TestStatus.PENDING
34
34
  self._status = self.set_status(report)
@@ -41,7 +41,7 @@ class TestObject:
41
41
 
42
42
  self.worker_id = worker_id
43
43
  self.file_path = report.location[0]
44
- self.tags = []
44
+ self.tags: List[str] = []
45
45
  self.browser = None
46
46
  self.trace = None
47
47
 
@@ -79,11 +79,11 @@ class TestObject:
79
79
 
80
80
  def update(self, report: TestReport) -> None:
81
81
  self.set_status(report)
82
- self.duration += 1000 * report.duration # pytest reports duration in seconds, CTRF requires milliseconds
83
82
  if report.when == "setup" and self.start == 0:
84
- self.start = report.start
83
+ self.start = int(report.start * 1000)
85
84
  if report.when == "teardown" and self.stop == 0:
86
- self.stop = report.stop
85
+ self.stop = int(report.stop * 1000)
86
+ self.duration = self.stop - self.start
87
87
  if report.longrepr and len(report.longreprtext) > 0:
88
88
  self.trace = report.longreprtext
89
89
  if hasattr(report, '_ctrf_metadata'):
@@ -91,7 +91,7 @@ class TestObject:
91
91
  self.browser = report._ctrf_metadata.get('browser')
92
92
 
93
93
  def serialize(self) -> dict:
94
- result: dict[str, Any] = {
94
+ result: Dict[str, Any] = {
95
95
  'name': self.name,
96
96
  'status': self._status.value,
97
97
  'raw_status': self.raw_status,
@@ -10,7 +10,7 @@ exclude = [
10
10
 
11
11
  [project]
12
12
  name = "pytest-json-ctrf"
13
- version = "0.3.7"
13
+ version = "0.5.0"
14
14
 
15
15
  dependencies = [
16
16
  "pytest>6.0.0",
@@ -21,7 +21,7 @@ authors = [
21
21
  ]
22
22
  description = "Pytest plugin to generate json report in CTRF (Common Test Report Format)"
23
23
  readme = "README.md"
24
- requires-python = ">=3.9"
24
+ requires-python = ">=3.8"
25
25
  classifiers = [
26
26
  "Framework :: Pytest",
27
27
  "Programming Language :: Python :: 3",
@@ -41,3 +41,9 @@ markers = [
41
41
 
42
42
  [project.entry-points.pytest11]
43
43
  ctrf = "ctrf.main"
44
+
45
+ [tool.uv]
46
+ dev-dependencies = [
47
+ "pytest-xdist>=2.0.0",
48
+ ]
49
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.3.7
3
+ Version: 0.5.0
4
4
  Summary: Pytest plugin to generate json report in CTRF (Common Test Report Format)
5
5
  Author: Oleksii Ostapov
6
6
  Project-URL: Infopulse, https://infopulse.com/
@@ -9,7 +9,7 @@ Classifier: Framework :: Pytest
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.9
12
+ Requires-Python: >=3.8
13
13
  Description-Content-Type: text/markdown
14
14
  Requires-Dist: pytest>6.0.0
15
15
 
@@ -110,6 +110,10 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
110
110
  - https://github.com/testomatio/pytestomatio -> Source of inspiration for creating pytest plugins
111
111
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
112
112
 
113
+ ## Changelog
114
+ - 0.5.0 - Changed logic of handling parametrized tests. Previously they were marked as retries, now they are reported as separate tests
115
+ - 0.4.1 - Introduced backward compatibility with python 3.8, fixed issues with the time formats
116
+
113
117
  ### Roadmap
114
118
  - Add screenshots handling
115
119
  - Add hooks for the report extension
@@ -48,8 +48,8 @@ def test_with_markers(pytester: Pytester):
48
48
 
49
49
 
50
50
  def test_with_plugin_no_xdist(ctrf_report_sync):
51
- assert ctrf_report_sync["results"]["summary"]["tests"] == 12
52
- assert ctrf_report_sync["results"]["summary"]["passed"] == 6
51
+ assert ctrf_report_sync["results"]["summary"]["tests"] == 20
52
+ assert ctrf_report_sync["results"]["summary"]["passed"] == 14
53
53
  assert ctrf_report_sync["results"]["summary"]["failed"] == 5
54
54
  assert ctrf_report_sync["results"]["summary"]["skipped"] == 1
55
55
 
@@ -70,8 +70,8 @@ def test_any_test_has_timestamps(ctrf_report_sync):
70
70
 
71
71
 
72
72
  def test_with_plugin_with_xdist(ctrf_report_xdist):
73
- assert ctrf_report_xdist["results"]["summary"]["tests"] == 12
74
- assert ctrf_report_xdist["results"]["summary"]["passed"] == 6
73
+ assert ctrf_report_xdist["results"]["summary"]["tests"] == 20
74
+ assert ctrf_report_xdist["results"]["summary"]["passed"] == 14
75
75
  assert ctrf_report_xdist["results"]["summary"]["failed"] == 5
76
76
  assert ctrf_report_xdist["results"]["summary"]["skipped"] == 1
77
77