pgpro-pytest-html-json-extractor 1.1.1__tar.gz → 1.1.2__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 (14) hide show
  1. {pgpro_pytest_html_json_extractor-1.1.1/src/pgpro_pytest_html_json_extractor.egg-info → pgpro_pytest_html_json_extractor-1.1.2}/PKG-INFO +1 -1
  2. pgpro_pytest_html_json_extractor-1.1.2/src/pgpro_pytest_html_json_extractor/__init__.py +1 -0
  3. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/src/pgpro_pytest_html_json_extractor/__main__.py +32 -5
  4. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2/src/pgpro_pytest_html_json_extractor.egg-info}/PKG-INFO +1 -1
  5. pgpro_pytest_html_json_extractor-1.1.1/src/pgpro_pytest_html_json_extractor/__init__.py +0 -1
  6. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/LICENSE +0 -0
  7. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/README.md +0 -0
  8. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/pyproject.toml +0 -0
  9. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/setup.cfg +0 -0
  10. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/src/pgpro_pytest_html_json_extractor.egg-info/SOURCES.txt +0 -0
  11. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/src/pgpro_pytest_html_json_extractor.egg-info/dependency_links.txt +0 -0
  12. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/src/pgpro_pytest_html_json_extractor.egg-info/entry_points.txt +0 -0
  13. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/src/pgpro_pytest_html_json_extractor.egg-info/requires.txt +0 -0
  14. {pgpro_pytest_html_json_extractor-1.1.1 → pgpro_pytest_html_json_extractor-1.1.2}/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.1.1
3
+ Version: 1.1.2
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
@@ -145,6 +145,15 @@ class PytestHtmlJsonExtractor:
145
145
  "Report does not have section with pytest-html link.",
146
146
  )
147
147
 
148
+ assert link is not None
149
+
150
+ if link.parent is None:
151
+ raise RuntimeError(
152
+ "Report pytest-html link does not have a parent element.",
153
+ )
154
+
155
+ assert link.parent is not None
156
+
148
157
  parent_text = link.parent.get_text()
149
158
 
150
159
  # Looking for pattern 'v' and digits (v4.0.2)
@@ -169,11 +178,19 @@ class PytestHtmlJsonExtractor:
169
178
  assert type(input_path) is str
170
179
  assert type(check_json) is bool
171
180
  assert type(output_path) is str
181
+ assert type(replace) is bool
172
182
 
173
183
  g_log.info("Processing report: {}".format(input_path))
174
184
 
175
185
  with open(input_path, "r", encoding="utf-8") as f:
176
- soup = bs4.BeautifulSoup(f, features="html.parser")
186
+ html_content = f.read()
187
+
188
+ assert type(html_content) is str
189
+
190
+ soup = bs4.BeautifulSoup(
191
+ html_content,
192
+ features="html.parser",
193
+ )
177
194
 
178
195
  html_version_s = __class__._extract_pytest_html_version(
179
196
  input_path,
@@ -236,8 +253,10 @@ class PytestHtmlJsonExtractor:
236
253
  soup: bs4.BeautifulSoup
237
254
 
238
255
  # --------------------------------------------------------------------
239
- # @staticmethod
240
- def _extract_json_from_html_4_0_2(ctx: tagExtractCtx):
256
+ @staticmethod
257
+ def _extract_json_from_html_4_0_2(
258
+ ctx: tagExtractCtx,
259
+ ):
241
260
  assert type(ctx) is __class__.tagExtractCtx
242
261
 
243
262
  containers = ctx.soup.select("#data-container")
@@ -359,13 +378,21 @@ class PytestHtmlJsonExtractor:
359
378
 
360
379
  # --------------------------------------------------------------------
361
380
  sm_ReportAdapterForPytestHtml_4_0_2 = tagReportAdapter(
362
- extractor_func=_extract_json_from_html_4_0_2,
381
+ # typing.cast is used to avoid a problem with py3.8
382
+ extractor_func=typing.cast(
383
+ staticmethod,
384
+ _extract_json_from_html_4_0_2,
385
+ ).__func__,
363
386
  escapes_log=UnescapeLogsMode.NO,
364
387
  )
365
388
 
366
389
  # --------------------------------------------------------------------
367
390
  sm_ReportAdapterForPytestHtml_4_1_0 = tagReportAdapter(
368
- extractor_func=_extract_json_from_html_4_0_2,
391
+ # typing.cast is used to avoid a problem with py3.8
392
+ extractor_func=typing.cast(
393
+ staticmethod,
394
+ _extract_json_from_html_4_0_2,
395
+ ).__func__,
369
396
  escapes_log=UnescapeLogsMode.YES,
370
397
  )
371
398
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgpro-pytest-html-json-extractor
3
- Version: 1.1.1
3
+ Version: 1.1.2
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