pytest-json-ctrf 0.6.3__tar.gz → 0.6.4__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.3/pytest_json_ctrf.egg-info → pytest_json_ctrf-0.6.4}/PKG-INFO +3 -1
  2. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/README.md +2 -0
  3. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/Report.py +11 -2
  4. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pyproject.toml +3 -1
  5. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4/pytest_json_ctrf.egg-info}/PKG-INFO +3 -1
  6. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/LICENSE +0 -0
  7. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/MANIFEST.in +0 -0
  8. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/BaseMetadataReport.py +0 -0
  9. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/CommonTestReportPlugin.py +0 -0
  10. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/TestObject.py +0 -0
  11. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/__init__.py +0 -0
  12. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/ctrf/main.py +0 -0
  13. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pytest_json_ctrf.egg-info/SOURCES.txt +0 -0
  14. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pytest_json_ctrf.egg-info/dependency_links.txt +0 -0
  15. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pytest_json_ctrf.egg-info/entry_points.txt +0 -0
  16. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pytest_json_ctrf.egg-info/requires.txt +0 -0
  17. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/pytest_json_ctrf.egg-info/top_level.txt +0 -0
  18. {pytest_json_ctrf-0.6.3 → pytest_json_ctrf-0.6.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.6.3
3
+ Version: 0.6.4
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,8 @@ 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.4 - summary `duration` is measured on a monotonic clock, so it stays correct when time-machine or freezegun travel is still active at the end of the session
136
+ - summary `start` and `stop` are still wall-clock timestamps and are shifted under that travel, so `duration` can differ from `stop - start`
135
137
  - 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
138
  - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
137
139
  - time between phases (report hooks, failure formatting) is no longer counted
@@ -115,6 +115,8 @@ 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.4 - summary `duration` is measured on a monotonic clock, so it stays correct when time-machine or freezegun travel is still active at the end of the session
119
+ - summary `start` and `stop` are still wall-clock timestamps and are shifted under that travel, so `duration` can differ from `stop - start`
118
120
  - 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
121
  - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
120
122
  - time between phases (report hooks, failure formatting) is no longer counted
@@ -13,16 +13,24 @@ from .TestObject import TestObject, TestStatus
13
13
 
14
14
 
15
15
  class Report:
16
+ # held on the class because freezegun replaces time.perf_counter and every module-level reference to it
17
+ _perf_counter = staticmethod(time.perf_counter)
18
+
16
19
  def __init__(self):
17
20
  self.test_items = OrderedDict()
18
21
  self.start_time = None
19
22
  self.stop_time = None
23
+ self._start_perf = None
24
+ self._duration_s = None
20
25
 
21
26
  def start(self) -> None:
22
27
  self.start_time = int(time.time() * 1000)
28
+ self._start_perf = self._perf_counter()
23
29
 
24
30
  def stop(self) -> None:
25
31
  self.stop_time = int(time.time() * 1000)
32
+ if self._start_perf is not None:
33
+ self._duration_s = self._perf_counter() - self._start_perf
26
34
 
27
35
  @staticmethod
28
36
  def _get_tool() -> dict:
@@ -49,8 +57,9 @@ class Report:
49
57
  'start': self.start_time,
50
58
  'stop': self.stop_time,
51
59
  }
52
- if self.start_time is not None and self.stop_time is not None:
53
- summary['duration'] = self.stop_time - self.start_time
60
+ # duration is monotonic, so unlike the wall-clock start/stop it survives time travel; it need not equal stop - start
61
+ if self._duration_s is not None:
62
+ summary['duration'] = round(self._duration_s * 1000)
54
63
  return summary
55
64
 
56
65
  @staticmethod
@@ -10,7 +10,7 @@ exclude = [
10
10
 
11
11
  [project]
12
12
  name = "pytest-json-ctrf"
13
- version = "0.6.3"
13
+ version = "0.6.4"
14
14
 
15
15
  # minimum pytest and Python versions: keep in sync with .github/workflows/deploy.yml and the README
16
16
  dependencies = [
@@ -45,7 +45,9 @@ ctrf = "ctrf.main"
45
45
 
46
46
  [dependency-groups]
47
47
  dev = [
48
+ "freezegun>=1.5",
48
49
  "jsonschema>=4.23.0",
49
50
  "pytest-rerunfailures>=14.0",
50
51
  "pytest-xdist>=3.6.1",
52
+ "time-machine>=2.10",
51
53
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.6.3
3
+ Version: 0.6.4
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,8 @@ 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.4 - summary `duration` is measured on a monotonic clock, so it stays correct when time-machine or freezegun travel is still active at the end of the session
136
+ - summary `start` and `stop` are still wall-clock timestamps and are shifted under that travel, so `duration` can differ from `stop - start`
135
137
  - 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
138
  - `start` and `stop` are still wall-clock timestamps, so `duration` can differ from `stop - start`
137
139
  - time between phases (report hooks, failure formatting) is no longer counted