pytest-json-ctrf 0.6.2__tar.gz → 0.6.3__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.6.2/pytest_json_ctrf.egg-info → pytest_json_ctrf-0.6.3}/PKG-INFO +4 -1
  2. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/README.md +3 -0
  3. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/TestObject.py +9 -2
  4. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pyproject.toml +1 -1
  5. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3/pytest_json_ctrf.egg-info}/PKG-INFO +4 -1
  6. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/LICENSE +0 -0
  7. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/MANIFEST.in +0 -0
  8. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/BaseMetadataReport.py +0 -0
  9. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/CommonTestReportPlugin.py +0 -0
  10. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/Report.py +0 -0
  11. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/__init__.py +0 -0
  12. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/ctrf/main.py +0 -0
  13. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pytest_json_ctrf.egg-info/SOURCES.txt +0 -0
  14. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pytest_json_ctrf.egg-info/dependency_links.txt +0 -0
  15. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pytest_json_ctrf.egg-info/entry_points.txt +0 -0
  16. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pytest_json_ctrf.egg-info/requires.txt +0 -0
  17. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/pytest_json_ctrf.egg-info/top_level.txt +0 -0
  18. {pytest_json_ctrf-0.6.2 → pytest_json_ctrf-0.6.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Pytest plugin to generate json report in CTRF (Common Test Report Format)
5
5
  Author: Oleksii Ostapov
6
6
  License-Expression: MIT
@@ -132,6 +132,9 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
132
132
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
133
133
 
134
134
  ## Changelog
135
+ - 0.6.3 - fixed issue 7 - test and retry attempt `duration` is the sum of pytest's monotonic phase durations, so it stays correct when a time-travel library such as time-machine moves the wall clock between tests
136
+ - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
137
+ - time between phases (report hooks, failure formatting) is no longer counted
135
138
  - 0.6.2 - minimum versions are now pytest 7.4 and Python 3.9 (drops Python 3.8). pytest 6.x failed at startup, even without `--ctrf`; 7.0–7.2 failed when `--ctrf` was used; 7.3 worked, but reported `pytest.fail(..., pytrace=False)` messages without the `Failed: ` prefix
136
139
  - 0.6.1 - proper license added to the package to fix build pipeline warnings
137
140
  - 0.6.0 - fixed issue 12 - report now validates against the CTRF schema. Thanks to [@jamesarosen](https://github.com/jamesarosen) for the detailed report!
@@ -115,6 +115,9 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
115
115
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
116
116
 
117
117
  ## Changelog
118
+ - 0.6.3 - fixed issue 7 - test and retry attempt `duration` is the sum of pytest's monotonic phase durations, so it stays correct when a time-travel library such as time-machine moves the wall clock between tests
119
+ - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
120
+ - time between phases (report hooks, failure formatting) is no longer counted
118
121
  - 0.6.2 - minimum versions are now pytest 7.4 and Python 3.9 (drops Python 3.8). pytest 6.x failed at startup, even without `--ctrf`; 7.0–7.2 failed when `--ctrf` was used; 7.3 worked, but reported `pytest.fail(..., pytrace=False)` messages without the `Failed: ` prefix
119
122
  - 0.6.1 - proper license added to the package to fix build pipeline warnings
120
123
  - 0.6.0 - fixed issue 12 - report now validates against the CTRF schema. Thanks to [@jamesarosen](https://github.com/jamesarosen) for the detailed report!
@@ -18,6 +18,7 @@ class TestObject:
18
18
  raw_status: Optional[str]
19
19
  start: int
20
20
  stop: int
21
+ _duration_s: float
21
22
  retries: int
22
23
  message: Optional[str]
23
24
 
@@ -48,6 +49,7 @@ class TestObject:
48
49
  self.trace = None
49
50
  self.start = 0
50
51
  self.stop = 0
52
+ self._duration_s = 0.0
51
53
  self._setup_seen = False
52
54
 
53
55
  @staticmethod
@@ -73,7 +75,7 @@ class TestObject:
73
75
  attempt = {
74
76
  'attempt': len(self.retry_attempts) + 1,
75
77
  'status': self._status.value,
76
- 'duration': max(self.stop - self.start, 0),
78
+ 'duration': round(self._duration_s * 1000),
77
79
  'start': self.start,
78
80
  'stop': self.stop,
79
81
  'message': self.message,
@@ -133,6 +135,11 @@ class TestObject:
133
135
  self._finish_attempt()
134
136
  self._setup_seen = True
135
137
  self.start = int(report.start * 1000)
138
+ # report.duration is monotonic, unlike the wall-clock start/stop.
139
+ # SubtestReport (pytest>=9) and pytest-subtests' SubTestReport carry a context;
140
+ # their time is already counted in the parent test's call phase
141
+ if not hasattr(report, 'context'):
142
+ self._duration_s += report.duration
136
143
  self.set_status(report)
137
144
  if report.when == "teardown":
138
145
  self.stop = int(report.stop * 1000)
@@ -146,7 +153,7 @@ class TestObject:
146
153
  'name': self.name,
147
154
  'status': self._status.value,
148
155
  'rawStatus': self.raw_status,
149
- 'duration': self.stop - self.start,
156
+ 'duration': round(self._duration_s * 1000),
150
157
  'start': self.start,
151
158
  'stop': self.stop,
152
159
  'suite': self.suite,
@@ -10,7 +10,7 @@ exclude = [
10
10
 
11
11
  [project]
12
12
  name = "pytest-json-ctrf"
13
- version = "0.6.2"
13
+ version = "0.6.3"
14
14
 
15
15
  # minimum pytest and Python versions: keep in sync with .github/workflows/deploy.yml and the README
16
16
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: Pytest plugin to generate json report in CTRF (Common Test Report Format)
5
5
  Author: Oleksii Ostapov
6
6
  License-Expression: MIT
@@ -132,6 +132,9 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
132
132
  - https://github.com/infopulse/Playwright-course-python -> The report will be used in the demo project as +1 report option
133
133
 
134
134
  ## Changelog
135
+ - 0.6.3 - fixed issue 7 - test and retry attempt `duration` is the sum of pytest's monotonic phase durations, so it stays correct when a time-travel library such as time-machine moves the wall clock between tests
136
+ - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
137
+ - time between phases (report hooks, failure formatting) is no longer counted
135
138
  - 0.6.2 - minimum versions are now pytest 7.4 and Python 3.9 (drops Python 3.8). pytest 6.x failed at startup, even without `--ctrf`; 7.0–7.2 failed when `--ctrf` was used; 7.3 worked, but reported `pytest.fail(..., pytrace=False)` messages without the `Failed: ` prefix
136
139
  - 0.6.1 - proper license added to the package to fix build pipeline warnings
137
140
  - 0.6.0 - fixed issue 12 - report now validates against the CTRF schema. Thanks to [@jamesarosen](https://github.com/jamesarosen) for the detailed report!