pytest-json-ctrf 0.3.5__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.
Files changed (18) hide show
  1. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/PKG-INFO +17 -3
  2. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/README.md +16 -2
  3. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/Report.py +11 -2
  4. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/TestObject.py +1 -1
  5. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pyproject.toml +2 -2
  6. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/PKG-INFO +17 -3
  7. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/BaseMetadataReport.py +0 -0
  8. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/CommonTestReportPlugin.py +0 -0
  9. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/__init__.py +0 -0
  10. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/ctrf/main.py +0 -0
  11. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/SOURCES.txt +0 -0
  12. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/dependency_links.txt +0 -0
  13. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/entry_points.txt +0 -0
  14. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/requires.txt +0 -0
  15. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/pytest_json_ctrf.egg-info/top_level.txt +0 -0
  16. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/setup.cfg +0 -0
  17. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/tests/test_example.py +0 -0
  18. {pytest_json_ctrf-0.3.5 → pytest_json_ctrf-0.3.7}/tests/test_plugin.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.3.5
3
+ Version: 0.3.7
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/
@@ -39,8 +39,16 @@ generate report.json file in the root directory of the project. File path is man
39
39
  ```bash
40
40
  pytest --ctrf report.json
41
41
  ```
42
+ Environment Variables may be used to specify the required Environment Object
43
+ fields when using the CTRF [slack-test-reporter][ctrf-slack-test-reporter-url].
42
44
 
43
- ## Json exampe
45
+ ```bash
46
+ CTRF_BUILD_NAME="Pytest JSON CTRF Report"
47
+ CTRF_BUILD_NUMBER="000"
48
+ CTRF_BUILD_URL="https://ctrf.io]"
49
+ ```
50
+
51
+ ## JSON example
44
52
 
45
53
  More info here: https://ctrf.io/docs/schema/examples
46
54
 
@@ -60,6 +68,11 @@ More info here: https://ctrf.io/docs/schema/examples
60
68
  "start": 1706644023,
61
69
  "stop": 1706644043
62
70
  },
71
+ "environment": {
72
+ "buildName": "Pytest JSON CTRF Report",
73
+ "buildNumber": "000",
74
+ "buildUrl": "https://ctrf.io"
75
+ },
63
76
  "tests": [
64
77
  {
65
78
  "name": "User should be able to login",
@@ -100,3 +113,4 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
100
113
  ### Roadmap
101
114
  - Add screenshots handling
102
115
  - Add hooks for the report extension
116
+ - [ctrf-slack-test-reporter-url]: https://github.com/ctrf-io/slack-test-reporter
@@ -24,8 +24,16 @@ generate report.json file in the root directory of the project. File path is man
24
24
  ```bash
25
25
  pytest --ctrf report.json
26
26
  ```
27
+ Environment Variables may be used to specify the required Environment Object
28
+ fields when using the CTRF [slack-test-reporter][ctrf-slack-test-reporter-url].
27
29
 
28
- ## Json exampe
30
+ ```bash
31
+ CTRF_BUILD_NAME="Pytest JSON CTRF Report"
32
+ CTRF_BUILD_NUMBER="000"
33
+ CTRF_BUILD_URL="https://ctrf.io]"
34
+ ```
35
+
36
+ ## JSON example
29
37
 
30
38
  More info here: https://ctrf.io/docs/schema/examples
31
39
 
@@ -45,6 +53,11 @@ More info here: https://ctrf.io/docs/schema/examples
45
53
  "start": 1706644023,
46
54
  "stop": 1706644043
47
55
  },
56
+ "environment": {
57
+ "buildName": "Pytest JSON CTRF Report",
58
+ "buildNumber": "000",
59
+ "buildUrl": "https://ctrf.io"
60
+ },
48
61
  "tests": [
49
62
  {
50
63
  "name": "User should be able to login",
@@ -84,4 +97,5 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
84
97
 
85
98
  ### Roadmap
86
99
  - Add screenshots handling
87
- - Add hooks for the report extension
100
+ - Add hooks for the report extension
101
+ - [ctrf-slack-test-reporter-url]: https://github.com/ctrf-io/slack-test-reporter
@@ -16,10 +16,10 @@ class Report:
16
16
  self.stop_time = None
17
17
 
18
18
  def start(self) -> None:
19
- self.start_time = time.time()
19
+ self.start_time = self.start_time = int(time.time() * 1000)
20
20
 
21
21
  def stop(self) -> None:
22
- self.stop_time = time.time()
22
+ self.stop_time = self.start_time = int(time.time() * 1000)
23
23
 
24
24
  @staticmethod
25
25
  def _get_tool() -> dict:
@@ -43,6 +43,14 @@ class Report:
43
43
  'stop': self.stop_time
44
44
  }
45
45
 
46
+ @staticmethod
47
+ def _get_environment() -> dict:
48
+ return {
49
+ "buildName": os.getenv("CTRF_BUILD_NAME", "Pytest JSON CTRF Report"),
50
+ "buildNumber": os.getenv("CTRF_BUILD_NUMBER", "000"),
51
+ "buildUrl": os.getenv("CTRF_BUILD_URL", "https://ctrf.io"),
52
+ }
53
+
46
54
  def collect(self, report: TestReport) -> None:
47
55
  if report.nodeid not in self.test_items.keys():
48
56
  worker_id = getattr(report, 'worker_id', None)
@@ -73,6 +81,7 @@ class Report:
73
81
  return {'results': {
74
82
  "tool": self._get_tool(),
75
83
  "summary": self._get_summary(),
84
+ "environment": self._get_environment(),
76
85
  "tests": [test.serialize() for test in self.prepared_tests.values()]
77
86
  }
78
87
  }
@@ -79,7 +79,7 @@ class TestObject:
79
79
 
80
80
  def update(self, report: TestReport) -> None:
81
81
  self.set_status(report)
82
- self.duration += report.duration
82
+ self.duration += 1000 * report.duration # pytest reports duration in seconds, CTRF requires milliseconds
83
83
  if report.when == "setup" and self.start == 0:
84
84
  self.start = report.start
85
85
  if report.when == "teardown" and self.stop == 0:
@@ -10,7 +10,7 @@ exclude = [
10
10
 
11
11
  [project]
12
12
  name = "pytest-json-ctrf"
13
- version = "0.3.5"
13
+ version = "0.3.7"
14
14
 
15
15
  dependencies = [
16
16
  "pytest>6.0.0",
@@ -40,4 +40,4 @@ markers = [
40
40
  ]
41
41
 
42
42
  [project.entry-points.pytest11]
43
- ctrf = "ctrf.main"
43
+ ctrf = "ctrf.main"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pytest-json-ctrf
3
- Version: 0.3.5
3
+ Version: 0.3.7
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/
@@ -39,8 +39,16 @@ generate report.json file in the root directory of the project. File path is man
39
39
  ```bash
40
40
  pytest --ctrf report.json
41
41
  ```
42
+ Environment Variables may be used to specify the required Environment Object
43
+ fields when using the CTRF [slack-test-reporter][ctrf-slack-test-reporter-url].
42
44
 
43
- ## Json exampe
45
+ ```bash
46
+ CTRF_BUILD_NAME="Pytest JSON CTRF Report"
47
+ CTRF_BUILD_NUMBER="000"
48
+ CTRF_BUILD_URL="https://ctrf.io]"
49
+ ```
50
+
51
+ ## JSON example
44
52
 
45
53
  More info here: https://ctrf.io/docs/schema/examples
46
54
 
@@ -60,6 +68,11 @@ More info here: https://ctrf.io/docs/schema/examples
60
68
  "start": 1706644023,
61
69
  "stop": 1706644043
62
70
  },
71
+ "environment": {
72
+ "buildName": "Pytest JSON CTRF Report",
73
+ "buildNumber": "000",
74
+ "buildUrl": "https://ctrf.io"
75
+ },
63
76
  "tests": [
64
77
  {
65
78
  "name": "User should be able to login",
@@ -100,3 +113,4 @@ The `pytest_runtest_logreport` hook in the controller node is used to collect th
100
113
  ### Roadmap
101
114
  - Add screenshots handling
102
115
  - Add hooks for the report extension
116
+ - [ctrf-slack-test-reporter-url]: https://github.com/ctrf-io/slack-test-reporter