robotframework-testdoc 0.1.5__py3-none-any.whl → 0.1.8__py3-none-any.whl

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.

Potentially problematic release.


This version of robotframework-testdoc might be problematic. Click here for more details.

@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robotframework-testdoc
3
- Version: 0.1.5
3
+ Version: 0.1.8
4
4
  Summary: A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts.
5
- Author-email: Marvin Klerx <marvinklerx1@gmail.com>
5
+ Author-email: Marvin Klerx <marvinklerx20@gmail.com>
6
6
  License: MIT
7
7
  Requires-Python: >=3.7
8
8
  Description-Content-Type: text/markdown
@@ -1,10 +1,10 @@
1
- robotframework_testdoc-0.1.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1
+ robotframework_testdoc-0.1.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
2
  testdoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  testdoc/__main__.py,sha256=09c4nsw4Vnp1LaK0CnlofJQFbKmeFexOXyTBDY9NrFk,67
4
- testdoc/cli.py,sha256=WyiuX9ONHMeeXAxXrF3XjR8Pal_WFg04dGVON7msrLc,4623
4
+ testdoc/cli.py,sha256=bh_Fh78v5K8ajmSHazI6HGEJ3-pJyZOvcGm1SznU0jA,4659
5
5
  testdoc/default.toml,sha256=PK7O2gat8326ZYOXBC1mt6-5ceBhdbgs0BL1uo4XLjQ,87
6
6
  testdoc/testdoc.py,sha256=cVJguXoFhkCM2nkUlZGB8m-6rBhKwthFFtdtz0T2l4Q,772
7
- testdoc/helper/cliargs.py,sha256=eT7-1WGhHXbVSdC4LetkQQmhrhuISF35V3Aody-ymEk,1285
7
+ testdoc/helper/cliargs.py,sha256=EtGqiUDKeMBkGZUSjtyFrPBjeOt5BnHazB5MlvfW8uk,2599
8
8
  testdoc/helper/datetimeconverter.py,sha256=1IuJ_rZlKKut3pallS9WSdlQ00YNQX2Nhf2oYWt7QDc,159
9
9
  testdoc/helper/logger.py,sha256=STPEEdMIGpK004xHDskj8zzW3knBWP05GllYajQMaSY,272
10
10
  testdoc/helper/pathconverter.py,sha256=Il4SX8EdpKPjOiZt97zC4TBLxp2tKUhfyyS2J1qWpyg,1656
@@ -14,12 +14,12 @@ testdoc/html/themes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
14
14
  testdoc/html/themes/theme_config.py,sha256=3AFUSoddhAZswcEsshbvqcnmbLOFaBYUFy-lrfNBV3Q,1495
15
15
  testdoc/html/themes/themes.py,sha256=6xlHW7O-XO9Z1B33_aRwzffkuWR65jM7CYXsZWUjdmY,1091
16
16
  testdoc/html_rendering/render.py,sha256=BzPGyePwjCFZAXRHDF-ccM2xRKY-6Cnym1-uDb9i1AQ,1083
17
- testdoc/parser/testcaseparser.py,sha256=69WGA2aM2NsC1mU8PVGXfW23TEoYhJDjEfsyNwW2AoM,1243
17
+ testdoc/parser/testcaseparser.py,sha256=tCRj_OH6DkdB_2Np2kvRVSpTHWdFh46IIip2AiFb0HA,1382
18
18
  testdoc/parser/testsuiteparser.py,sha256=eqFMaEa2aXYCkoAl8wLmA7NsPOx8oxY8KfTKVxyGIPU,2595
19
19
  testdoc/parser/modifier/sourceprefixmodifier.py,sha256=Vy_keEKztF7UrjtWjmkU7usGR7E-xLvxJOWocPRu6KI,3950
20
20
  testdoc/parser/modifier/suitefilemodifier.py,sha256=OuDuleQj4dRjUcu0AROEPZ-2vR3lWJfWmQVuoWLkXuY,4865
21
- robotframework_testdoc-0.1.5.dist-info/METADATA,sha256=xzo1mMtpPf_-pQ8nU4cZ5bB1vcBcwf8AStjqwN7ABpE,4970
22
- robotframework_testdoc-0.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
23
- robotframework_testdoc-0.1.5.dist-info/entry_points.txt,sha256=BUHy23mdlGCqYOWpsvRhSb1c0tPMzIwyTwr-sHI6xUs,45
24
- robotframework_testdoc-0.1.5.dist-info/top_level.txt,sha256=p1axpYooAmdwwXQOzFsSXF3u_-88QFKCDxPf67siv3Y,8
25
- robotframework_testdoc-0.1.5.dist-info/RECORD,,
21
+ robotframework_testdoc-0.1.8.dist-info/METADATA,sha256=ktSWzaMXgU0CRYK_M57Gqh--dNOOyP1k47ZwAPWCVVU,4971
22
+ robotframework_testdoc-0.1.8.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
23
+ robotframework_testdoc-0.1.8.dist-info/entry_points.txt,sha256=BUHy23mdlGCqYOWpsvRhSb1c0tPMzIwyTwr-sHI6xUs,45
24
+ robotframework_testdoc-0.1.8.dist-info/top_level.txt,sha256=p1axpYooAmdwwXQOzFsSXF3u_-88QFKCDxPf67siv3Y,8
25
+ robotframework_testdoc-0.1.8.dist-info/RECORD,,
testdoc/cli.py CHANGED
@@ -47,14 +47,15 @@ def main(
47
47
  Welcome to robotframework-testdoc - the new test documentation generator for your Robot Framework tests!
48
48
  """
49
49
  color = "green"
50
- click.echo(click.style("""
50
+ entrypoint_msg = """
51
51
  ████████╗███████╗███████╗████████╗██████╗ ███████╗███████╗
52
52
  ╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██ ██╗██ ██║██╔════╝
53
53
  ██║ █████╗ ███████╗ ██║ ██ ██║██ ██║██║
54
54
  ██║ ██╔══╝ ╚════██║ ██║ ██ ██║██ ██║██║
55
55
  ██║ ███████╗███████║ ██║ ██████╔╝███████║███████╗
56
56
  ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═════╝
57
- """, fg=color)
57
+ """
58
+ click.echo(click.style(entrypoint_msg, fg=color)
58
59
  )
59
60
 
60
61
  args_instance = CommandLineArguments()
testdoc/helper/cliargs.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import List
2
+ from typing import Any, List
3
3
  import tomli
4
+ import os
4
5
 
5
6
  @dataclass
6
7
  class CommandLineArgumentsData:
@@ -32,13 +33,52 @@ class CommandLineArguments:
32
33
  cls.data = CommandLineArgumentsData()
33
34
  return cls._instance
34
35
 
36
+ ###
37
+ ### Load configuration file
38
+ ###
35
39
  def load_from_config_file(self, file_path: str):
36
40
  with open(file_path, "rb") as f:
37
41
  config = tomli.load(f)
38
42
 
43
+ _is_pyproject = self._is_pyproject_config(file_path)
44
+ if _is_pyproject:
45
+ self._handle_pyproject_config(config)
46
+ else:
47
+ self._handle_custom_config(config)
48
+
49
+ ###
50
+ ### Read pyproject.toml
51
+ ###
52
+ def _handle_pyproject_config(self, config: dict[str, Any]):
53
+ testdoc_config = config.get("tool", {}).get("testdoc", {})
54
+
55
+ if "colors" in testdoc_config:
56
+ self.data.colors = testdoc_config["colors"]
57
+
58
+ if "metadata" in testdoc_config:
59
+ if hasattr(self.data, "metadata"):
60
+ setattr(self.data, "metadata", testdoc_config["metadata"])
61
+
62
+ for key, value in testdoc_config.items():
63
+ if key in ("colors", "metadata"):
64
+ continue
65
+ if hasattr(self.data, key):
66
+ setattr(self.data, key, value)
67
+
68
+ ###
69
+ ### Read custom.toml
70
+ ###
71
+ def _handle_custom_config(self, config: dict[str, Any]):
39
72
  if "colors" in config:
40
73
  self.data.colors = config["colors"]
41
74
 
42
75
  for key, value in config.items():
43
76
  if hasattr(self.data, key):
44
- setattr(self.data, key, value)
77
+ setattr(self.data, key, value)
78
+
79
+ #####################################################################################
80
+
81
+ def _is_pyproject_config(self, file_path) -> bool:
82
+ return os.path.basename(file_path) == "pyproject.toml"
83
+
84
+ #####################################################################################
@@ -1,4 +1,5 @@
1
1
  from robot.api import TestSuite
2
+ from robot.errors import DataError
2
3
  from ..helper.cliargs import CommandLineArguments
3
4
 
4
5
  class TestCaseParser():
@@ -25,8 +26,11 @@ class TestCaseParser():
25
26
 
26
27
  # Consider tags via officially provided robot api
27
28
  def consider_tags(self, suite: TestSuite) -> TestSuite:
28
- if len(self.args.include) > 0:
29
- suite.configure(include_tags=self.args.include)
30
- if len(self.args.exclude) > 0:
31
- suite.configure(exclude_tags=self.args.exclude)
32
- return suite
29
+ try:
30
+ if len(self.args.include) > 0:
31
+ suite.configure(include_tags=self.args.include)
32
+ if len(self.args.exclude) > 0:
33
+ suite.configure(exclude_tags=self.args.exclude)
34
+ return suite
35
+ except DataError as e:
36
+ raise DataError(e.message)