pgpro-pytest-html-json-extractor 1.0.0__tar.gz → 1.1.1__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.
- {pgpro_pytest_html_json_extractor-1.0.0/src/pgpro_pytest_html_json_extractor.egg-info → pgpro_pytest_html_json_extractor-1.1.1}/PKG-INFO +17 -2
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/README.md +16 -1
- pgpro_pytest_html_json_extractor-1.1.1/src/pgpro_pytest_html_json_extractor/__init__.py +1 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor/__main__.py +168 -36
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1/src/pgpro_pytest_html_json_extractor.egg-info}/PKG-INFO +17 -2
- pgpro_pytest_html_json_extractor-1.0.0/src/pgpro_pytest_html_json_extractor/__init__.py +0 -1
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/LICENSE +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/pyproject.toml +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/setup.cfg +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor.egg-info/SOURCES.txt +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor.egg-info/dependency_links.txt +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor.egg-info/entry_points.txt +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor.egg-info/requires.txt +0 -0
- {pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/src/pgpro_pytest_html_json_extractor.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgpro-pytest-html-json-extractor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: A tool to extract json from pytest-html report
|
|
5
5
|
Author-email: Postgres Professional <info@postgrespro.ru>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,6 +33,10 @@ Dynamic: license-file
|
|
|
33
33
|
# pgpro-pytest-html-json-extractor
|
|
34
34
|
A tool to extract json data from pytest-html report. Developed and maintained by Postgres Professional.
|
|
35
35
|
|
|
36
|
+
## Key features
|
|
37
|
+
- Extractor supports pytest-html v4.0.2+
|
|
38
|
+
- Extractor produces JSON with unescaped HTML entities in log messages (for pytest-html v4.1.0+)
|
|
39
|
+
|
|
36
40
|
## Installation
|
|
37
41
|
You can install the package directly from the repository (until it's published to PyPI):
|
|
38
42
|
```bash
|
|
@@ -55,11 +59,22 @@ pgpro-pytest-html-json-extractor report.html -o report.json
|
|
|
55
59
|
| :--- | :--- | :--- | :--- | :--- |
|
|
56
60
|
| `--version` | | No | Show program's version number and exit | None |
|
|
57
61
|
| `--out` | `-o` | Yes | Name of the output JSON file | None |
|
|
58
|
-
| `--verbose` | `-v` | No | Level of logging verbosity | 3 |
|
|
62
|
+
| `--verbose` | `-v` | No | Level of logging verbosity | `3` |
|
|
59
63
|
| `--no-check-json` | | No | Do not validate json data after extraction | None |
|
|
64
|
+
| `--unescape-logs` | | No | HTML entity decoding mode for logs (`auto`, `yes`, `no`) | `auto` |
|
|
60
65
|
| `--replace` | `-r` | No | Replace output if it exists | None |
|
|
61
66
|
| `input` | | Yes | Positional argument for HTML file | None |
|
|
62
67
|
|
|
68
|
+
#### Log Unescaping Modes (--unescape-logs)
|
|
69
|
+
|
|
70
|
+
The tool provides granular control over how HTML entities (like `"`, `&` or `"`) are handled within test logs:
|
|
71
|
+
|
|
72
|
+
- **auto (Default)**: Smart detection mode. Automatically decides whether to decode entities based on the detected pytest-html report version. It ensures that logs are restored to their original "human-readable" state while maintaining the safety of other report metadata.
|
|
73
|
+
|
|
74
|
+
- **yes**: Forceful decoding. Every HTML entity in the log field will be converted back to its literal character. Use this if you are dealing with heavily encoded custom output.
|
|
75
|
+
|
|
76
|
+
- **no**: Raw mode. Disables all decoding, leaving the log data exactly as it was stored in the HTML source (including "Russian Doll" double-encoding). Ideal for debugging report structure or forensic data analysis.
|
|
77
|
+
|
|
63
78
|
## Contributing
|
|
64
79
|
1. Fork the repository.
|
|
65
80
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`).
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
# pgpro-pytest-html-json-extractor
|
|
6
6
|
A tool to extract json data from pytest-html report. Developed and maintained by Postgres Professional.
|
|
7
7
|
|
|
8
|
+
## Key features
|
|
9
|
+
- Extractor supports pytest-html v4.0.2+
|
|
10
|
+
- Extractor produces JSON with unescaped HTML entities in log messages (for pytest-html v4.1.0+)
|
|
11
|
+
|
|
8
12
|
## Installation
|
|
9
13
|
You can install the package directly from the repository (until it's published to PyPI):
|
|
10
14
|
```bash
|
|
@@ -27,11 +31,22 @@ pgpro-pytest-html-json-extractor report.html -o report.json
|
|
|
27
31
|
| :--- | :--- | :--- | :--- | :--- |
|
|
28
32
|
| `--version` | | No | Show program's version number and exit | None |
|
|
29
33
|
| `--out` | `-o` | Yes | Name of the output JSON file | None |
|
|
30
|
-
| `--verbose` | `-v` | No | Level of logging verbosity | 3 |
|
|
34
|
+
| `--verbose` | `-v` | No | Level of logging verbosity | `3` |
|
|
31
35
|
| `--no-check-json` | | No | Do not validate json data after extraction | None |
|
|
36
|
+
| `--unescape-logs` | | No | HTML entity decoding mode for logs (`auto`, `yes`, `no`) | `auto` |
|
|
32
37
|
| `--replace` | `-r` | No | Replace output if it exists | None |
|
|
33
38
|
| `input` | | Yes | Positional argument for HTML file | None |
|
|
34
39
|
|
|
40
|
+
#### Log Unescaping Modes (--unescape-logs)
|
|
41
|
+
|
|
42
|
+
The tool provides granular control over how HTML entities (like `"`, `&` or `"`) are handled within test logs:
|
|
43
|
+
|
|
44
|
+
- **auto (Default)**: Smart detection mode. Automatically decides whether to decode entities based on the detected pytest-html report version. It ensures that logs are restored to their original "human-readable" state while maintaining the safety of other report metadata.
|
|
45
|
+
|
|
46
|
+
- **yes**: Forceful decoding. Every HTML entity in the log field will be converted back to its literal character. Use this if you are dealing with heavily encoded custom output.
|
|
47
|
+
|
|
48
|
+
- **no**: Raw mode. Disables all decoding, leaving the log data exactly as it was stored in the HTML source (including "Russian Doll" double-encoding). Ideal for debugging report structure or forensic data analysis.
|
|
49
|
+
|
|
35
50
|
## Contributing
|
|
36
51
|
1. Fork the repository.
|
|
37
52
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.1.1"
|
|
@@ -9,6 +9,9 @@ import os
|
|
|
9
9
|
import sys
|
|
10
10
|
import re
|
|
11
11
|
import typing
|
|
12
|
+
import html
|
|
13
|
+
import dataclasses
|
|
14
|
+
import enum
|
|
12
15
|
|
|
13
16
|
from . import __version__ as current_version
|
|
14
17
|
|
|
@@ -16,7 +19,19 @@ from packaging.version import Version
|
|
|
16
19
|
|
|
17
20
|
# //////////////////////////////////////////////////////////////////////////////
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
g_log = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# //////////////////////////////////////////////////////////////////////////////
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class UnescapeLogsMode(enum.Enum):
|
|
29
|
+
AUTO = "auto"
|
|
30
|
+
YES = "yes"
|
|
31
|
+
NO = "no"
|
|
32
|
+
|
|
33
|
+
def __str__(self):
|
|
34
|
+
return self.value
|
|
20
35
|
|
|
21
36
|
|
|
22
37
|
# //////////////////////////////////////////////////////////////////////////////
|
|
@@ -73,14 +88,23 @@ def parse_arguments() -> argparse.Namespace:
|
|
|
73
88
|
action="store_true",
|
|
74
89
|
)
|
|
75
90
|
|
|
76
|
-
# Логика включения/выключения
|
|
77
91
|
command_parser.add_argument(
|
|
78
92
|
"--no-check-json",
|
|
79
93
|
dest="check_json",
|
|
80
94
|
action="store_false",
|
|
81
95
|
help="skip JSON format validation after extraction",
|
|
82
96
|
)
|
|
83
|
-
|
|
97
|
+
|
|
98
|
+
command_parser.add_argument(
|
|
99
|
+
"--unescape-logs",
|
|
100
|
+
dest="unescape_logs",
|
|
101
|
+
type=UnescapeLogsMode,
|
|
102
|
+
choices=list(UnescapeLogsMode),
|
|
103
|
+
default=UnescapeLogsMode.AUTO,
|
|
104
|
+
help="Unescape HTML entities in logs (default: {})".format(
|
|
105
|
+
UnescapeLogsMode.AUTO,
|
|
106
|
+
),
|
|
107
|
+
)
|
|
84
108
|
|
|
85
109
|
command_parser.add_argument(
|
|
86
110
|
"--verbose",
|
|
@@ -140,56 +164,151 @@ class PytestHtmlJsonExtractor:
|
|
|
140
164
|
check_json: bool,
|
|
141
165
|
output_path: str,
|
|
142
166
|
replace: bool,
|
|
167
|
+
unescape_logs: UnescapeLogsMode = UnescapeLogsMode.AUTO,
|
|
143
168
|
):
|
|
144
169
|
assert type(input_path) is str
|
|
145
170
|
assert type(check_json) is bool
|
|
146
171
|
assert type(output_path) is str
|
|
147
172
|
|
|
148
|
-
|
|
173
|
+
g_log.info("Processing report: {}".format(input_path))
|
|
149
174
|
|
|
150
175
|
with open(input_path, "r", encoding="utf-8") as f:
|
|
151
176
|
soup = bs4.BeautifulSoup(f, features="html.parser")
|
|
152
177
|
|
|
153
|
-
|
|
178
|
+
html_version_s = __class__._extract_pytest_html_version(
|
|
154
179
|
input_path,
|
|
155
180
|
soup,
|
|
156
181
|
)
|
|
157
|
-
assert type(
|
|
182
|
+
assert type(html_version_s) is str
|
|
183
|
+
|
|
184
|
+
html_version = Version(html_version_s)
|
|
158
185
|
|
|
159
186
|
min_version = Version(__class__.C_MININAL_PYTEST_HTML_VERSION)
|
|
160
|
-
if
|
|
187
|
+
if html_version < min_version:
|
|
161
188
|
__class__._raise_err__unsupported_html_version(
|
|
162
189
|
input_path,
|
|
163
|
-
|
|
190
|
+
html_version_s,
|
|
164
191
|
)
|
|
165
192
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
__class__.
|
|
193
|
+
if html_version >= Version("4.1.0"):
|
|
194
|
+
adapter = __class__.sm_ReportAdapterForPytestHtml_4_1_0
|
|
195
|
+
else:
|
|
196
|
+
adapter = __class__.sm_ReportAdapterForPytestHtml_4_0_2
|
|
170
197
|
|
|
171
|
-
|
|
172
|
-
|
|
198
|
+
extractCtx = __class__.tagExtractCtx(
|
|
199
|
+
soup,
|
|
200
|
+
)
|
|
173
201
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
input_path,
|
|
177
|
-
)
|
|
202
|
+
assert isinstance(adapter.extractor_func, typing.Callable)
|
|
203
|
+
jsonblob = adapter.extractor_func(extractCtx)
|
|
178
204
|
|
|
179
|
-
|
|
205
|
+
# memory is freed
|
|
206
|
+
del extractCtx
|
|
207
|
+
del soup
|
|
208
|
+
|
|
209
|
+
if unescape_logs == UnescapeLogsMode.AUTO:
|
|
210
|
+
unescape_logs = adapter.escapes_log
|
|
211
|
+
|
|
212
|
+
assert unescape_logs != UnescapeLogsMode.AUTO
|
|
213
|
+
|
|
214
|
+
if unescape_logs == UnescapeLogsMode.NO:
|
|
215
|
+
g_log.debug("Html escapes is skipped ...")
|
|
216
|
+
else:
|
|
217
|
+
jsondata = json.loads(jsonblob)
|
|
218
|
+
__class__._inplace_unescape_logs__html4_1_0(jsondata)
|
|
219
|
+
jsonblob = json.dumps(jsondata, ensure_ascii=False)
|
|
180
220
|
|
|
181
221
|
if check_json:
|
|
182
|
-
|
|
183
|
-
json.loads(
|
|
222
|
+
g_log.info("Json data is checked...")
|
|
223
|
+
json.loads(jsonblob)
|
|
184
224
|
|
|
185
225
|
# write to file
|
|
186
226
|
write_mode = "w" if replace else "x"
|
|
187
227
|
|
|
188
228
|
with open(output_path, write_mode, encoding="utf-8") as f:
|
|
189
|
-
f.write(
|
|
229
|
+
f.write(jsonblob)
|
|
190
230
|
|
|
191
231
|
return
|
|
192
232
|
|
|
233
|
+
# --------------------------------------------------------------------
|
|
234
|
+
@dataclasses.dataclass
|
|
235
|
+
class tagExtractCtx:
|
|
236
|
+
soup: bs4.BeautifulSoup
|
|
237
|
+
|
|
238
|
+
# --------------------------------------------------------------------
|
|
239
|
+
# @staticmethod
|
|
240
|
+
def _extract_json_from_html_4_0_2(ctx: tagExtractCtx):
|
|
241
|
+
assert type(ctx) is __class__.tagExtractCtx
|
|
242
|
+
|
|
243
|
+
containers = ctx.soup.select("#data-container")
|
|
244
|
+
if not containers:
|
|
245
|
+
__class__._raise_err__json_blob_is_not_found()
|
|
246
|
+
|
|
247
|
+
report_data_container = containers[0]
|
|
248
|
+
|
|
249
|
+
jsonblob = report_data_container.get("data-jsonblob")
|
|
250
|
+
|
|
251
|
+
# ----------
|
|
252
|
+
if jsonblob is None:
|
|
253
|
+
__class__._raise_err__json_blob_is_not_found()
|
|
254
|
+
|
|
255
|
+
assert type(jsonblob) is str
|
|
256
|
+
|
|
257
|
+
return jsonblob
|
|
258
|
+
|
|
259
|
+
# --------------------------------------------------------------------
|
|
260
|
+
@staticmethod
|
|
261
|
+
def _inplace_unescape_logs__html4_1_0(
|
|
262
|
+
jsondata: typing.Any,
|
|
263
|
+
) -> None:
|
|
264
|
+
assert jsondata is not None
|
|
265
|
+
|
|
266
|
+
# https://github.com/pytest-dev/pytest-html/releases/tag/4.1.0
|
|
267
|
+
# fix: Escaping HTML in log (#757)
|
|
268
|
+
|
|
269
|
+
C_DATA_ELEMENT_ID__TESTS = "tests"
|
|
270
|
+
C_DATA_ELEMENT_ID__LOG = "log"
|
|
271
|
+
|
|
272
|
+
g_log.debug("Html escapes in logs are unpacking ...")
|
|
273
|
+
|
|
274
|
+
if type(jsondata) is not dict:
|
|
275
|
+
return
|
|
276
|
+
|
|
277
|
+
tests = jsondata.get(C_DATA_ELEMENT_ID__TESTS)
|
|
278
|
+
|
|
279
|
+
if tests is None:
|
|
280
|
+
return
|
|
281
|
+
|
|
282
|
+
if type(tests) is not dict:
|
|
283
|
+
return
|
|
284
|
+
|
|
285
|
+
for _, test_launches in tests.items():
|
|
286
|
+
if test_launches is None:
|
|
287
|
+
continue
|
|
288
|
+
|
|
289
|
+
if type(test_launches) is not list:
|
|
290
|
+
continue
|
|
291
|
+
|
|
292
|
+
for t in test_launches:
|
|
293
|
+
if t is None:
|
|
294
|
+
continue
|
|
295
|
+
|
|
296
|
+
if type(t) is not dict:
|
|
297
|
+
continue
|
|
298
|
+
|
|
299
|
+
log_data = t.get(C_DATA_ELEMENT_ID__LOG)
|
|
300
|
+
|
|
301
|
+
if log_data is None:
|
|
302
|
+
continue
|
|
303
|
+
|
|
304
|
+
if type(log_data) is not str:
|
|
305
|
+
continue
|
|
306
|
+
|
|
307
|
+
t[C_DATA_ELEMENT_ID__LOG] = html.unescape(log_data)
|
|
308
|
+
continue
|
|
309
|
+
continue
|
|
310
|
+
return
|
|
311
|
+
|
|
193
312
|
# --------------------------------------------------------------------
|
|
194
313
|
@staticmethod
|
|
195
314
|
def _raise_err__no_section_with_version(report_path) -> typing.NoReturn:
|
|
@@ -228,16 +347,28 @@ class PytestHtmlJsonExtractor:
|
|
|
228
347
|
|
|
229
348
|
# --------------------------------------------------------------------
|
|
230
349
|
@staticmethod
|
|
231
|
-
def _raise_err__json_blob_is_not_found(
|
|
232
|
-
|
|
233
|
-
) -> typing.NoReturn:
|
|
234
|
-
assert report_path is not None
|
|
235
|
-
|
|
236
|
-
err_msg = "Source file [{}] does not countains json data.".format(
|
|
237
|
-
report_path,
|
|
238
|
-
)
|
|
350
|
+
def _raise_err__json_blob_is_not_found() -> typing.NoReturn:
|
|
351
|
+
err_msg = "Source file does not countains json data."
|
|
239
352
|
raise RuntimeError(err_msg)
|
|
240
353
|
|
|
354
|
+
# --------------------------------------------------------------------
|
|
355
|
+
@dataclasses.dataclass
|
|
356
|
+
class tagReportAdapter:
|
|
357
|
+
extractor_func: typing.Callable
|
|
358
|
+
escapes_log: UnescapeLogsMode
|
|
359
|
+
|
|
360
|
+
# --------------------------------------------------------------------
|
|
361
|
+
sm_ReportAdapterForPytestHtml_4_0_2 = tagReportAdapter(
|
|
362
|
+
extractor_func=_extract_json_from_html_4_0_2,
|
|
363
|
+
escapes_log=UnescapeLogsMode.NO,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
# --------------------------------------------------------------------
|
|
367
|
+
sm_ReportAdapterForPytestHtml_4_1_0 = tagReportAdapter(
|
|
368
|
+
extractor_func=_extract_json_from_html_4_0_2,
|
|
369
|
+
escapes_log=UnescapeLogsMode.YES,
|
|
370
|
+
)
|
|
371
|
+
|
|
241
372
|
|
|
242
373
|
# //////////////////////////////////////////////////////////////////////////////
|
|
243
374
|
|
|
@@ -248,7 +379,7 @@ def main(arguments) -> int:
|
|
|
248
379
|
# 1. Collect from positional files
|
|
249
380
|
input_file = os.path.abspath(arguments.input)
|
|
250
381
|
if not os.path.isfile(input_file):
|
|
251
|
-
|
|
382
|
+
g_log.error(
|
|
252
383
|
"Invalid input: '{}' is not a file or does not exist.".format(
|
|
253
384
|
arguments.input,
|
|
254
385
|
),
|
|
@@ -257,7 +388,7 @@ def main(arguments) -> int:
|
|
|
257
388
|
|
|
258
389
|
# 2. Check output file
|
|
259
390
|
if not arguments.replace and os.path.exists(arguments.out):
|
|
260
|
-
|
|
391
|
+
g_log.error(
|
|
261
392
|
"Invalid input: output file '{}' already exists.".format(
|
|
262
393
|
arguments.out,
|
|
263
394
|
),
|
|
@@ -266,7 +397,7 @@ def main(arguments) -> int:
|
|
|
266
397
|
|
|
267
398
|
# 3. Final check
|
|
268
399
|
if has_errors:
|
|
269
|
-
|
|
400
|
+
g_log.error(
|
|
270
401
|
"Termination due to input errors.",
|
|
271
402
|
)
|
|
272
403
|
return 1
|
|
@@ -277,9 +408,10 @@ def main(arguments) -> int:
|
|
|
277
408
|
arguments.check_json,
|
|
278
409
|
arguments.out,
|
|
279
410
|
arguments.replace,
|
|
411
|
+
arguments.unescape_logs,
|
|
280
412
|
)
|
|
281
413
|
|
|
282
|
-
|
|
414
|
+
g_log.info(
|
|
283
415
|
"Successfully extracted json into {}".format(
|
|
284
416
|
arguments.out,
|
|
285
417
|
),
|
|
@@ -295,11 +427,11 @@ def cli():
|
|
|
295
427
|
|
|
296
428
|
logging.basicConfig(level=int((6 - arguments.verbose) * 10))
|
|
297
429
|
|
|
298
|
-
|
|
430
|
+
g_log.debug("opts = {}".format(arguments))
|
|
299
431
|
|
|
300
432
|
r = main(arguments)
|
|
301
433
|
|
|
302
|
-
|
|
434
|
+
g_log.debug("exiting")
|
|
303
435
|
return r
|
|
304
436
|
|
|
305
437
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgpro-pytest-html-json-extractor
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: A tool to extract json from pytest-html report
|
|
5
5
|
Author-email: Postgres Professional <info@postgrespro.ru>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,6 +33,10 @@ Dynamic: license-file
|
|
|
33
33
|
# pgpro-pytest-html-json-extractor
|
|
34
34
|
A tool to extract json data from pytest-html report. Developed and maintained by Postgres Professional.
|
|
35
35
|
|
|
36
|
+
## Key features
|
|
37
|
+
- Extractor supports pytest-html v4.0.2+
|
|
38
|
+
- Extractor produces JSON with unescaped HTML entities in log messages (for pytest-html v4.1.0+)
|
|
39
|
+
|
|
36
40
|
## Installation
|
|
37
41
|
You can install the package directly from the repository (until it's published to PyPI):
|
|
38
42
|
```bash
|
|
@@ -55,11 +59,22 @@ pgpro-pytest-html-json-extractor report.html -o report.json
|
|
|
55
59
|
| :--- | :--- | :--- | :--- | :--- |
|
|
56
60
|
| `--version` | | No | Show program's version number and exit | None |
|
|
57
61
|
| `--out` | `-o` | Yes | Name of the output JSON file | None |
|
|
58
|
-
| `--verbose` | `-v` | No | Level of logging verbosity | 3 |
|
|
62
|
+
| `--verbose` | `-v` | No | Level of logging verbosity | `3` |
|
|
59
63
|
| `--no-check-json` | | No | Do not validate json data after extraction | None |
|
|
64
|
+
| `--unescape-logs` | | No | HTML entity decoding mode for logs (`auto`, `yes`, `no`) | `auto` |
|
|
60
65
|
| `--replace` | `-r` | No | Replace output if it exists | None |
|
|
61
66
|
| `input` | | Yes | Positional argument for HTML file | None |
|
|
62
67
|
|
|
68
|
+
#### Log Unescaping Modes (--unescape-logs)
|
|
69
|
+
|
|
70
|
+
The tool provides granular control over how HTML entities (like `"`, `&` or `"`) are handled within test logs:
|
|
71
|
+
|
|
72
|
+
- **auto (Default)**: Smart detection mode. Automatically decides whether to decode entities based on the detected pytest-html report version. It ensures that logs are restored to their original "human-readable" state while maintaining the safety of other report metadata.
|
|
73
|
+
|
|
74
|
+
- **yes**: Forceful decoding. Every HTML entity in the log field will be converted back to its literal character. Use this if you are dealing with heavily encoded custom output.
|
|
75
|
+
|
|
76
|
+
- **no**: Raw mode. Disables all decoding, leaving the log data exactly as it was stored in the HTML source (including "Russian Doll" double-encoding). Ideal for debugging report structure or forensic data analysis.
|
|
77
|
+
|
|
63
78
|
## Contributing
|
|
64
79
|
1. Fork the repository.
|
|
65
80
|
2. Create your feature branch (`git checkout -b feature/amazing-feature`).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.0"
|
|
File without changes
|
{pgpro_pytest_html_json_extractor-1.0.0 → pgpro_pytest_html_json_extractor-1.1.1}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|