robotframework-testdoc 0.2.4__tar.gz → 0.2.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.
Potentially problematic release.
This version of robotframework-testdoc might be problematic. Click here for more details.
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/PKG-INFO +55 -4
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/README.md +54 -3
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/test_cli.py +1 -1
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/pyproject.toml +1 -1
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/PKG-INFO +55 -4
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/SOURCES.txt +1 -1
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/cli.py +34 -33
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/default.toml +1 -1
- robotframework_testdoc-0.2.7/src/testdoc/helper/cliargs.py +100 -0
- robotframework_testdoc-0.2.7/src/testdoc/helper/pathconverter.py +30 -0
- robotframework_testdoc-0.2.7/src/testdoc/helper/toml_reader.py +50 -0
- {robotframework_testdoc-0.2.4/src/testdoc/html_rendering → robotframework_testdoc-0.2.7/src/testdoc/html/rendering}/render.py +7 -7
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/templates/v2/jinja_template_03.html +1 -5
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/themes/theme_config.py +6 -2
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/themes/themes.py +24 -2
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/modifier/sourceprefixmodifier.py +2 -2
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/modifier/suitefilemodifier.py +1 -1
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/testcaseparser.py +17 -8
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/testsuiteparser.py +1 -8
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/testdoc.py +3 -6
- robotframework_testdoc-0.2.4/src/testdoc/helper/cliargs.py +0 -83
- robotframework_testdoc-0.2.4/src/testdoc/helper/pathconverter.py +0 -62
- robotframework_testdoc-0.2.4/src/testdoc/helper/toml_reader.py +0 -11
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/.github/workflows/build.yml +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/.github/workflows/release.yml +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/.gitignore +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/LICENSE +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/config/config_with_colors.toml +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/config/testdoc.toml +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/config_pyproject/example_pyproject.toml +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/test_cli.robot +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/html_v1_common.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/html_v2_root.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/html_v2_suitefile.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/style_blue.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/style_dark.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/docs/style_robot.png +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/setup.cfg +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/dependency_links.txt +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/entry_points.txt +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/requires.txt +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/robotframework_testdoc.egg-info/top_level.txt +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/__init__.py +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/__main__.py +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/helper/datetimeconverter.py +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/helper/logger.py +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/images/robotframework.svg +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/templates/v1/jinja_template_01.html +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/templates/v1/jinja_template_02.html +0 -0
- {robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/themes/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-testdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts.
|
|
5
5
|
Author-email: Marvin Klerx <marvinklerx20@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -118,6 +118,51 @@ For using this config file, just call the following command:
|
|
|
118
118
|
testdoc -c path/to/config.toml tests/ TestDocumentation.html
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### pyproject.toml vs. custom toml file
|
|
122
|
+
|
|
123
|
+
Using the ``pyproject`` requires to define the ``testdoc`` sections with the prefix ``tool.``
|
|
124
|
+
Example section start: ``[tool.testdoc]``
|
|
125
|
+
|
|
126
|
+
Using your own custom toml-file, does not require you to use the prefix. Here, you can just use ``[testdoc]`` as section header.
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Example Configuration File
|
|
130
|
+
```toml
|
|
131
|
+
[tool.testdoc]
|
|
132
|
+
title = "New title of HTML document"
|
|
133
|
+
name = "New name of root suite element"
|
|
134
|
+
doc = "New doc text of root suite element"
|
|
135
|
+
sourceprefix = "gitlab::https://gitlab.com/myrepo/repo_path"
|
|
136
|
+
include = ["TagA", "TagB"]
|
|
137
|
+
exclude = ["TagC"]
|
|
138
|
+
hide_tags = true
|
|
139
|
+
hide_test_doc = true
|
|
140
|
+
hide_suite_doc = true
|
|
141
|
+
hide_source = true
|
|
142
|
+
hide_keywords = true
|
|
143
|
+
style = "blue"
|
|
144
|
+
verbose_mode = false
|
|
145
|
+
|
|
146
|
+
[tool.testdoc.metadata]
|
|
147
|
+
Author = "Your-Name"
|
|
148
|
+
Version = "1.0.0"
|
|
149
|
+
Source = "AnySourceAsMetaData"
|
|
150
|
+
|
|
151
|
+
[tool.testdoc.colors]
|
|
152
|
+
# Use predefined theme:
|
|
153
|
+
default = "blue"
|
|
154
|
+
# OR
|
|
155
|
+
# Use custom colors:
|
|
156
|
+
background = "#000028"
|
|
157
|
+
inner_color = "#000028"
|
|
158
|
+
button_active_color = "#193966"
|
|
159
|
+
button_hover_color = "#193966"
|
|
160
|
+
border_color = "#CCCCCC"
|
|
161
|
+
text_color = "#CCCCCC"
|
|
162
|
+
title_color = "#00ffb9"
|
|
163
|
+
robot_icon = "#00ffb9"
|
|
164
|
+
```
|
|
165
|
+
|
|
121
166
|
## HTML Template Selection
|
|
122
167
|
|
|
123
168
|
You can choose between multiple HTML template for the design of your test documentation.
|
|
@@ -165,15 +210,21 @@ Therefore, please use the following syntax: for the toml file
|
|
|
165
210
|
# Use the default theme
|
|
166
211
|
default = "default"
|
|
167
212
|
default = 0
|
|
168
|
-
# Use the
|
|
213
|
+
# Use the dark theme
|
|
169
214
|
default = "dark"
|
|
170
215
|
default = 1
|
|
171
|
-
# Use the
|
|
216
|
+
# Use the blue theme
|
|
172
217
|
default = "blue"
|
|
173
218
|
default = 2
|
|
174
|
-
# Use the
|
|
219
|
+
# Use the robot theme
|
|
175
220
|
default = "robot"
|
|
176
221
|
default = 3
|
|
222
|
+
# Use the dark robot theme
|
|
223
|
+
default = "robot_dark"
|
|
224
|
+
default = 4
|
|
225
|
+
# Use the green theme
|
|
226
|
+
default = "green"
|
|
227
|
+
default = 5
|
|
177
228
|
```
|
|
178
229
|
|
|
179
230
|
For setting it via CLI, please use the following:
|
|
@@ -95,6 +95,51 @@ For using this config file, just call the following command:
|
|
|
95
95
|
testdoc -c path/to/config.toml tests/ TestDocumentation.html
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
### pyproject.toml vs. custom toml file
|
|
99
|
+
|
|
100
|
+
Using the ``pyproject`` requires to define the ``testdoc`` sections with the prefix ``tool.``
|
|
101
|
+
Example section start: ``[tool.testdoc]``
|
|
102
|
+
|
|
103
|
+
Using your own custom toml-file, does not require you to use the prefix. Here, you can just use ``[testdoc]`` as section header.
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Example Configuration File
|
|
107
|
+
```toml
|
|
108
|
+
[tool.testdoc]
|
|
109
|
+
title = "New title of HTML document"
|
|
110
|
+
name = "New name of root suite element"
|
|
111
|
+
doc = "New doc text of root suite element"
|
|
112
|
+
sourceprefix = "gitlab::https://gitlab.com/myrepo/repo_path"
|
|
113
|
+
include = ["TagA", "TagB"]
|
|
114
|
+
exclude = ["TagC"]
|
|
115
|
+
hide_tags = true
|
|
116
|
+
hide_test_doc = true
|
|
117
|
+
hide_suite_doc = true
|
|
118
|
+
hide_source = true
|
|
119
|
+
hide_keywords = true
|
|
120
|
+
style = "blue"
|
|
121
|
+
verbose_mode = false
|
|
122
|
+
|
|
123
|
+
[tool.testdoc.metadata]
|
|
124
|
+
Author = "Your-Name"
|
|
125
|
+
Version = "1.0.0"
|
|
126
|
+
Source = "AnySourceAsMetaData"
|
|
127
|
+
|
|
128
|
+
[tool.testdoc.colors]
|
|
129
|
+
# Use predefined theme:
|
|
130
|
+
default = "blue"
|
|
131
|
+
# OR
|
|
132
|
+
# Use custom colors:
|
|
133
|
+
background = "#000028"
|
|
134
|
+
inner_color = "#000028"
|
|
135
|
+
button_active_color = "#193966"
|
|
136
|
+
button_hover_color = "#193966"
|
|
137
|
+
border_color = "#CCCCCC"
|
|
138
|
+
text_color = "#CCCCCC"
|
|
139
|
+
title_color = "#00ffb9"
|
|
140
|
+
robot_icon = "#00ffb9"
|
|
141
|
+
```
|
|
142
|
+
|
|
98
143
|
## HTML Template Selection
|
|
99
144
|
|
|
100
145
|
You can choose between multiple HTML template for the design of your test documentation.
|
|
@@ -142,15 +187,21 @@ Therefore, please use the following syntax: for the toml file
|
|
|
142
187
|
# Use the default theme
|
|
143
188
|
default = "default"
|
|
144
189
|
default = 0
|
|
145
|
-
# Use the
|
|
190
|
+
# Use the dark theme
|
|
146
191
|
default = "dark"
|
|
147
192
|
default = 1
|
|
148
|
-
# Use the
|
|
193
|
+
# Use the blue theme
|
|
149
194
|
default = "blue"
|
|
150
195
|
default = 2
|
|
151
|
-
# Use the
|
|
196
|
+
# Use the robot theme
|
|
152
197
|
default = "robot"
|
|
153
198
|
default = 3
|
|
199
|
+
# Use the dark robot theme
|
|
200
|
+
default = "robot_dark"
|
|
201
|
+
default = 4
|
|
202
|
+
# Use the green theme
|
|
203
|
+
default = "green"
|
|
204
|
+
default = 5
|
|
154
205
|
```
|
|
155
206
|
|
|
156
207
|
For setting it via CLI, please use the following:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "robotframework-testdoc"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.7"
|
|
8
8
|
description = "A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.7"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: robotframework-testdoc
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts.
|
|
5
5
|
Author-email: Marvin Klerx <marvinklerx20@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -118,6 +118,51 @@ For using this config file, just call the following command:
|
|
|
118
118
|
testdoc -c path/to/config.toml tests/ TestDocumentation.html
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
### pyproject.toml vs. custom toml file
|
|
122
|
+
|
|
123
|
+
Using the ``pyproject`` requires to define the ``testdoc`` sections with the prefix ``tool.``
|
|
124
|
+
Example section start: ``[tool.testdoc]``
|
|
125
|
+
|
|
126
|
+
Using your own custom toml-file, does not require you to use the prefix. Here, you can just use ``[testdoc]`` as section header.
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Example Configuration File
|
|
130
|
+
```toml
|
|
131
|
+
[tool.testdoc]
|
|
132
|
+
title = "New title of HTML document"
|
|
133
|
+
name = "New name of root suite element"
|
|
134
|
+
doc = "New doc text of root suite element"
|
|
135
|
+
sourceprefix = "gitlab::https://gitlab.com/myrepo/repo_path"
|
|
136
|
+
include = ["TagA", "TagB"]
|
|
137
|
+
exclude = ["TagC"]
|
|
138
|
+
hide_tags = true
|
|
139
|
+
hide_test_doc = true
|
|
140
|
+
hide_suite_doc = true
|
|
141
|
+
hide_source = true
|
|
142
|
+
hide_keywords = true
|
|
143
|
+
style = "blue"
|
|
144
|
+
verbose_mode = false
|
|
145
|
+
|
|
146
|
+
[tool.testdoc.metadata]
|
|
147
|
+
Author = "Your-Name"
|
|
148
|
+
Version = "1.0.0"
|
|
149
|
+
Source = "AnySourceAsMetaData"
|
|
150
|
+
|
|
151
|
+
[tool.testdoc.colors]
|
|
152
|
+
# Use predefined theme:
|
|
153
|
+
default = "blue"
|
|
154
|
+
# OR
|
|
155
|
+
# Use custom colors:
|
|
156
|
+
background = "#000028"
|
|
157
|
+
inner_color = "#000028"
|
|
158
|
+
button_active_color = "#193966"
|
|
159
|
+
button_hover_color = "#193966"
|
|
160
|
+
border_color = "#CCCCCC"
|
|
161
|
+
text_color = "#CCCCCC"
|
|
162
|
+
title_color = "#00ffb9"
|
|
163
|
+
robot_icon = "#00ffb9"
|
|
164
|
+
```
|
|
165
|
+
|
|
121
166
|
## HTML Template Selection
|
|
122
167
|
|
|
123
168
|
You can choose between multiple HTML template for the design of your test documentation.
|
|
@@ -165,15 +210,21 @@ Therefore, please use the following syntax: for the toml file
|
|
|
165
210
|
# Use the default theme
|
|
166
211
|
default = "default"
|
|
167
212
|
default = 0
|
|
168
|
-
# Use the
|
|
213
|
+
# Use the dark theme
|
|
169
214
|
default = "dark"
|
|
170
215
|
default = 1
|
|
171
|
-
# Use the
|
|
216
|
+
# Use the blue theme
|
|
172
217
|
default = "blue"
|
|
173
218
|
default = 2
|
|
174
|
-
# Use the
|
|
219
|
+
# Use the robot theme
|
|
175
220
|
default = "robot"
|
|
176
221
|
default = 3
|
|
222
|
+
# Use the dark robot theme
|
|
223
|
+
default = "robot_dark"
|
|
224
|
+
default = 4
|
|
225
|
+
# Use the green theme
|
|
226
|
+
default = "green"
|
|
227
|
+
default = 5
|
|
177
228
|
```
|
|
178
229
|
|
|
179
230
|
For setting it via CLI, please use the following:
|
|
@@ -32,13 +32,13 @@ src/testdoc/helper/logger.py
|
|
|
32
32
|
src/testdoc/helper/pathconverter.py
|
|
33
33
|
src/testdoc/helper/toml_reader.py
|
|
34
34
|
src/testdoc/html/images/robotframework.svg
|
|
35
|
+
src/testdoc/html/rendering/render.py
|
|
35
36
|
src/testdoc/html/templates/v1/jinja_template_01.html
|
|
36
37
|
src/testdoc/html/templates/v1/jinja_template_02.html
|
|
37
38
|
src/testdoc/html/templates/v2/jinja_template_03.html
|
|
38
39
|
src/testdoc/html/themes/__init__.py
|
|
39
40
|
src/testdoc/html/themes/theme_config.py
|
|
40
41
|
src/testdoc/html/themes/themes.py
|
|
41
|
-
src/testdoc/html_rendering/render.py
|
|
42
42
|
src/testdoc/parser/testcaseparser.py
|
|
43
43
|
src/testdoc/parser/testsuiteparser.py
|
|
44
44
|
src/testdoc/parser/modifier/sourceprefixmodifier.py
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import click
|
|
2
|
-
import os
|
|
3
2
|
|
|
4
3
|
from .testdoc import TestDoc
|
|
5
4
|
from .helper.cliargs import CommandLineArguments
|
|
@@ -47,8 +46,12 @@ def main(
|
|
|
47
46
|
path,
|
|
48
47
|
output,
|
|
49
48
|
):
|
|
50
|
-
"""
|
|
51
|
-
|
|
49
|
+
"""Welcome to robotframework-testdoc - the new test documentation generator for your Robot Framework tests!
|
|
50
|
+
|
|
51
|
+
# Basic Usage:
|
|
52
|
+
$ testdoc tests/ TestDocumentation.html
|
|
53
|
+
|
|
54
|
+
See more in the README.md of the GitHub Project: https://github.com/MarvKler/robotframework-testdoc/blob/main/README.md
|
|
52
55
|
"""
|
|
53
56
|
color = "green"
|
|
54
57
|
entrypoint_msg = """
|
|
@@ -62,38 +65,36 @@ def main(
|
|
|
62
65
|
click.echo(click.style(entrypoint_msg, fg=color)
|
|
63
66
|
)
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
|
|
68
|
+
args_to_set = dict(
|
|
69
|
+
title=title,
|
|
70
|
+
name=name,
|
|
71
|
+
doc=doc,
|
|
72
|
+
metadata=dict(item.split("=", 1) for item in metadata) if metadata else None,
|
|
73
|
+
sourceprefix=sourceprefix,
|
|
74
|
+
include=list(include),
|
|
75
|
+
exclude=list(exclude),
|
|
76
|
+
hide_tags=hide_tags,
|
|
77
|
+
hide_test_doc=hide_test_doc,
|
|
78
|
+
hide_suite_doc=hide_suite_doc,
|
|
79
|
+
hide_source=hide_source,
|
|
80
|
+
hide_keywords=hide_keywords,
|
|
81
|
+
style=style,
|
|
82
|
+
html_template=html_template,
|
|
83
|
+
config_file=configfile,
|
|
84
|
+
verbose_mode=verbose,
|
|
85
|
+
suite_file=list(path),
|
|
86
|
+
output_file=output,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Expose CLI args
|
|
90
|
+
args_to_set = {k: v for k, v in args_to_set.items() if v is not None}
|
|
91
|
+
CommandLineArguments().set_args(**args_to_set)
|
|
71
92
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"doc": doc or None,
|
|
77
|
-
"metadata": dict(item.split("=", 1) for item in metadata) if metadata else None,
|
|
78
|
-
"sourceprefix": sourceprefix,
|
|
79
|
-
"include": list(include) if include else None,
|
|
80
|
-
"exclude": list(exclude) if exclude else None,
|
|
81
|
-
"hide_tags": hide_tags or None,
|
|
82
|
-
"hide_test_doc": hide_test_doc or None,
|
|
83
|
-
"hide_suite_doc": hide_suite_doc or None,
|
|
84
|
-
"hide_source": hide_source or None,
|
|
85
|
-
"hide_keywords": hide_keywords or None,
|
|
86
|
-
"verbose_mode": verbose or None,
|
|
87
|
-
"style": style or None,
|
|
88
|
-
"html_template": html_template or None,
|
|
89
|
-
"config_file": configfile or None,
|
|
90
|
-
}
|
|
91
|
-
args.suite_file = path
|
|
92
|
-
args.output_file = output
|
|
93
|
+
# Read & expose TOML args
|
|
94
|
+
if configfile:
|
|
95
|
+
from .helper.toml_reader import TOMLReader
|
|
96
|
+
TOMLReader().load_from_config_file(configfile)
|
|
93
97
|
|
|
94
|
-
for key, value in cli_params.items():
|
|
95
|
-
if value is not None:
|
|
96
|
-
setattr(args, key, value)
|
|
97
98
|
TestDoc().main()
|
|
98
99
|
|
|
99
100
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
class CommandLineArguments:
|
|
2
|
+
_instance = None
|
|
3
|
+
def __new__(cls):
|
|
4
|
+
if cls._instance is None:
|
|
5
|
+
cls._instance = super().__new__(cls)
|
|
6
|
+
cls._instance._args = {}
|
|
7
|
+
return cls._instance
|
|
8
|
+
|
|
9
|
+
def update_args_if_not_set(self, **kwargs):
|
|
10
|
+
for key, value in kwargs.items():
|
|
11
|
+
if key not in self._args:
|
|
12
|
+
self._args[key] = value
|
|
13
|
+
|
|
14
|
+
def set_args(self, **kwargs):
|
|
15
|
+
self._args = kwargs
|
|
16
|
+
|
|
17
|
+
def __getattr__(self, name):
|
|
18
|
+
if name in self._args:
|
|
19
|
+
return self._args[name]
|
|
20
|
+
raise AttributeError(f"'CommandLineArguments' object has no attribute '{name}'")
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def title(self):
|
|
24
|
+
return self._args.get("title", "Robot Framework - Test Documentation")
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def name(self):
|
|
28
|
+
return self._args.get("name", None)
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def doc(self):
|
|
32
|
+
return self._args.get("doc", None)
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def metadata(self):
|
|
36
|
+
return self._args.get("metadata", None)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def sourceprefix(self):
|
|
40
|
+
return self._args.get("sourceprefix", None)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def include(self):
|
|
44
|
+
return self._args.get("include", [])
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def exclude(self):
|
|
48
|
+
return self._args.get("exclude", [])
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def hide_tags(self):
|
|
52
|
+
return self._args.get("hide_tags", False)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def hide_test_doc(self):
|
|
56
|
+
return self._args.get("hide_test_doc", False)
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def hide_suite_doc(self):
|
|
60
|
+
return self._args.get("hide_suite_doc", False)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def hide_source(self):
|
|
64
|
+
return self._args.get("hide_source", False)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def hide_keywords(self):
|
|
68
|
+
return self._args.get("hide_keywords", False)
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def config_file(self):
|
|
72
|
+
return self._args.get("config_file", None)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def verbose_mode(self):
|
|
76
|
+
return self._args.get("verbose_mode", False)
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def suite_file(self):
|
|
80
|
+
return self._args.get("suite_file", None)
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def style(self):
|
|
84
|
+
return self._args.get("style", None)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def html_template(self):
|
|
88
|
+
return self._args.get("html_template", "v2")
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def output_file(self):
|
|
92
|
+
return self._args.get("output_file", None)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def colors(self):
|
|
96
|
+
return self._args.get("colors", None)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def all_as_dict(self):
|
|
100
|
+
return self._args
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from .cliargs import CommandLineArguments
|
|
4
|
+
from .logger import Logger
|
|
5
|
+
|
|
6
|
+
class PathConverter():
|
|
7
|
+
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self.args = CommandLineArguments()
|
|
10
|
+
|
|
11
|
+
def path_convertion(self) -> str:
|
|
12
|
+
output_path = self.args.output_file
|
|
13
|
+
output_path = PathConverter().conv_generic_path(path=output_path)
|
|
14
|
+
|
|
15
|
+
# Print to console
|
|
16
|
+
if self.args.verbose_mode:
|
|
17
|
+
Logger().LogKeyValue("Saving to output file: ", output_path)
|
|
18
|
+
return output_path
|
|
19
|
+
|
|
20
|
+
def conv_generic_path(self,
|
|
21
|
+
path: str
|
|
22
|
+
) -> str:
|
|
23
|
+
"""
|
|
24
|
+
Generate OS independent path.
|
|
25
|
+
"""
|
|
26
|
+
abs_path = os.path.abspath(path)
|
|
27
|
+
generic_path = os.path.normpath(abs_path)
|
|
28
|
+
if os.name == "nt":
|
|
29
|
+
generic_path = generic_path.replace("\\", "/")
|
|
30
|
+
return generic_path
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from .cliargs import CommandLineArguments
|
|
2
|
+
|
|
3
|
+
import tomli
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
class TOMLReader():
|
|
7
|
+
|
|
8
|
+
###
|
|
9
|
+
### Generic function to read toml files
|
|
10
|
+
###
|
|
11
|
+
def _read_toml(self, file_path:str):
|
|
12
|
+
try:
|
|
13
|
+
with open(file_path, "rb") as f:
|
|
14
|
+
config = tomli.load(f)
|
|
15
|
+
return config
|
|
16
|
+
except Exception as e:
|
|
17
|
+
raise ImportError(f"Cannot read toml file in: {file_path} with error: \n{e}")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
###
|
|
21
|
+
### Functions to handle TOML files with configuration for testdoc tool
|
|
22
|
+
###
|
|
23
|
+
def load_from_config_file(self, file_path: str):
|
|
24
|
+
config = TOMLReader()._read_toml(file_path)
|
|
25
|
+
is_pyproject = self._is_pyproject_config(file_path)
|
|
26
|
+
|
|
27
|
+
if is_pyproject:
|
|
28
|
+
self._handle_pyproject_config(config)
|
|
29
|
+
else:
|
|
30
|
+
self._handle_custom_config(config)
|
|
31
|
+
|
|
32
|
+
def _handle_pyproject_config(self, config: dict):
|
|
33
|
+
testdoc_config = config.get("tool", {}).get("testdoc", {})
|
|
34
|
+
self._apply_config_to_cliargs(testdoc_config)
|
|
35
|
+
|
|
36
|
+
def _handle_custom_config(self, config: dict):
|
|
37
|
+
self._apply_config_to_cliargs(config)
|
|
38
|
+
|
|
39
|
+
def _apply_config_to_cliargs(self, config: dict):
|
|
40
|
+
args_to_set = {}
|
|
41
|
+
|
|
42
|
+
for key, value in config.items():
|
|
43
|
+
if isinstance(value, tuple):
|
|
44
|
+
value = list(value)
|
|
45
|
+
args_to_set[key] = value
|
|
46
|
+
|
|
47
|
+
CommandLineArguments().update_args_if_not_set(**args_to_set)
|
|
48
|
+
|
|
49
|
+
def _is_pyproject_config(self, file_path) -> bool:
|
|
50
|
+
return os.path.basename(file_path) == "pyproject.toml"
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
from jinja2 import Environment, FileSystemLoader
|
|
2
2
|
import os
|
|
3
3
|
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
4
|
+
from ...html.themes.theme_config import ThemeConfig
|
|
5
|
+
from ...helper.cliargs import CommandLineArguments
|
|
6
|
+
from ...helper.datetimeconverter import DateTimeConverter
|
|
7
|
+
from ...helper.logger import Logger
|
|
8
8
|
|
|
9
9
|
class TestDocHtmlRendering():
|
|
10
10
|
|
|
11
11
|
def __init__(self):
|
|
12
|
-
self.args = CommandLineArguments()
|
|
12
|
+
self.args = CommandLineArguments()
|
|
13
13
|
self._html_templ_selection()
|
|
14
14
|
|
|
15
15
|
def _html_templ_selection(self):
|
|
@@ -17,11 +17,11 @@ class TestDocHtmlRendering():
|
|
|
17
17
|
if self.args.html_template == "v1":
|
|
18
18
|
self.HTML_TEMPLATE_VERSION = self.args.html_template
|
|
19
19
|
self.HTML_TEMPLATE_NAME = "jinja_template_01.html"
|
|
20
|
-
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "
|
|
20
|
+
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates", self.HTML_TEMPLATE_VERSION)
|
|
21
21
|
elif self.args.html_template == "v2":
|
|
22
22
|
self.HTML_TEMPLATE_VERSION = self.args.html_template
|
|
23
23
|
self.HTML_TEMPLATE_NAME = "jinja_template_03.html"
|
|
24
|
-
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "
|
|
24
|
+
self.TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates", self.HTML_TEMPLATE_VERSION)
|
|
25
25
|
else:
|
|
26
26
|
raise ValueError(f"CLI Argument 'html_template' got value '{self.args.html_template}' - value not known!")
|
|
27
27
|
|
|
@@ -77,11 +77,7 @@
|
|
|
77
77
|
<tr>
|
|
78
78
|
<td style="width: 10%; font-weight: bold;">🏷 Tags:</td>
|
|
79
79
|
<td style="text-align: left;">
|
|
80
|
-
{
|
|
81
|
-
{{ test.tags }}
|
|
82
|
-
{% else %}
|
|
83
|
-
{{ test.tags | join(', ') }}
|
|
84
|
-
{% endif %}
|
|
80
|
+
{{ test.tags | join(', ') }}
|
|
85
81
|
</td>
|
|
86
82
|
</tr>
|
|
87
83
|
{% endif %}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from ...helper.cliargs import CommandLineArguments
|
|
2
|
-
from .themes import DEFAULT_THEME, ROBOT_THEME, DARK_THEME, BLUE_THEME
|
|
2
|
+
from .themes import DEFAULT_THEME, ROBOT_THEME, DARK_THEME, BLUE_THEME, ROBOT_THEME_DARK, GREEN_THEME
|
|
3
3
|
|
|
4
4
|
import os
|
|
5
5
|
import tomli
|
|
@@ -9,7 +9,7 @@ class ThemeConfig():
|
|
|
9
9
|
default_config = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "default.toml")
|
|
10
10
|
|
|
11
11
|
def __init__(self):
|
|
12
|
-
self.args = CommandLineArguments()
|
|
12
|
+
self.args = CommandLineArguments()
|
|
13
13
|
with open(self.default_config, "rb") as file:
|
|
14
14
|
self.config = tomli.load(file)
|
|
15
15
|
|
|
@@ -38,4 +38,8 @@ class ThemeConfig():
|
|
|
38
38
|
return ROBOT_THEME
|
|
39
39
|
if theme == "blue" or theme == 3:
|
|
40
40
|
return BLUE_THEME
|
|
41
|
+
if theme == "robot_dark" or theme == 4:
|
|
42
|
+
return ROBOT_THEME_DARK
|
|
43
|
+
if theme == "green" or theme == 5:
|
|
44
|
+
return GREEN_THEME
|
|
41
45
|
|
{robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/themes/themes.py
RENAMED
|
@@ -13,14 +13,36 @@ DEFAULT_THEME = {
|
|
|
13
13
|
ROBOT_THEME = {
|
|
14
14
|
"background": "#f8f9fa",
|
|
15
15
|
"inner_color": "#f8f9fa",
|
|
16
|
-
"button_active_color": "#
|
|
17
|
-
"button_hover_color": "#
|
|
16
|
+
"button_active_color": "#dcdcdc",
|
|
17
|
+
"button_hover_color": "#dcdcdc",
|
|
18
18
|
"border_color": "black",
|
|
19
19
|
"text_color": "black",
|
|
20
20
|
"title_color": "black",
|
|
21
21
|
"robot_icon": "#00c0b5",
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
ROBOT_THEME_DARK = {
|
|
25
|
+
"background": "#1b1b1d",
|
|
26
|
+
"inner_color": "#1b1b1d",
|
|
27
|
+
"button_active_color": "#272729",
|
|
28
|
+
"button_hover_color": "#5F5F5F",
|
|
29
|
+
"border_color": "#e3e3e3",
|
|
30
|
+
"text_color": "#e3e3e3",
|
|
31
|
+
"title_color": "#e3e3e3",
|
|
32
|
+
"robot_icon": "#00c0b5",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
GREEN_THEME = {
|
|
36
|
+
"background": "#1e1e1e",
|
|
37
|
+
"inner_color": "#1e1e1e",
|
|
38
|
+
"button_active_color": "#272729",
|
|
39
|
+
"button_hover_color": "#5F5F5F",
|
|
40
|
+
"border_color": "#e3e3e3",
|
|
41
|
+
"text_color": "#009770",
|
|
42
|
+
"title_color": "#009770",
|
|
43
|
+
"robot_icon": "#009770",
|
|
44
|
+
}
|
|
45
|
+
|
|
24
46
|
DARK_THEME = {
|
|
25
47
|
"background": "#303030",
|
|
26
48
|
"inner_color": "#303030",
|
|
@@ -39,7 +39,7 @@ class SourcePrefixModifier():
|
|
|
39
39
|
GITLAB_CONNECTOR = "-/blob/main/"
|
|
40
40
|
|
|
41
41
|
def __init__(self):
|
|
42
|
-
self.args = CommandLineArguments()
|
|
42
|
+
self.args = CommandLineArguments()
|
|
43
43
|
|
|
44
44
|
def _prefix_validation(self, prefix: str) -> list:
|
|
45
45
|
if "::" not in prefix:
|
|
@@ -85,7 +85,7 @@ class GitLabModifier():
|
|
|
85
85
|
git_root = self._get_git_root(file_path)
|
|
86
86
|
git_branch = self._get_git_branch(git_root)
|
|
87
87
|
if not git_root:
|
|
88
|
-
return "
|
|
88
|
+
return "Unable to fetch GitLab URL!"
|
|
89
89
|
rel_path = os.path.relpath(file_path, git_root).replace(os.sep, "/")
|
|
90
90
|
return prefix.rstrip("/") + "/-/blob/" + git_branch + "/" + rel_path
|
|
91
91
|
|
|
@@ -7,7 +7,7 @@ from .sourceprefixmodifier import SourcePrefixModifier
|
|
|
7
7
|
class SuiteFileModifier():
|
|
8
8
|
|
|
9
9
|
def __init__(self):
|
|
10
|
-
self.args = CommandLineArguments()
|
|
10
|
+
self.args = CommandLineArguments()
|
|
11
11
|
self.suite = None
|
|
12
12
|
|
|
13
13
|
#############################################################################################################################
|
{robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/testcaseparser.py
RENAMED
|
@@ -7,7 +7,7 @@ import textwrap
|
|
|
7
7
|
class TestCaseParser():
|
|
8
8
|
|
|
9
9
|
def __init__(self):
|
|
10
|
-
self.args = CommandLineArguments()
|
|
10
|
+
self.args = CommandLineArguments()
|
|
11
11
|
|
|
12
12
|
def parse_test(self,
|
|
13
13
|
suite: TestSuite,
|
|
@@ -19,7 +19,7 @@ class TestCaseParser():
|
|
|
19
19
|
"name": test.name,
|
|
20
20
|
"doc": "<br>".join(line.replace("\\n","") for line in test.doc.splitlines()
|
|
21
21
|
if line.strip()) if test.doc else "No Test Case Documentation Available",
|
|
22
|
-
"tags": test.tags if test.tags else "No Tags Configured",
|
|
22
|
+
"tags": test.tags if test.tags else ["No Tags Configured"],
|
|
23
23
|
"source": str(test.source),
|
|
24
24
|
"keywords": self._keyword_parser(test.body)
|
|
25
25
|
}
|
|
@@ -47,7 +47,7 @@ class TestCaseParser():
|
|
|
47
47
|
|
|
48
48
|
# Fallback in case of no keywords
|
|
49
49
|
if len(_keyword_object) == 0:
|
|
50
|
-
return "No Keyword Calls in Test"
|
|
50
|
+
return ["No Keyword Calls in Test"]
|
|
51
51
|
return _keyword_object
|
|
52
52
|
|
|
53
53
|
def _handle_keyword_types(self, kw: Keyword, indent: int = 0):
|
|
@@ -105,6 +105,19 @@ class TestCaseParser():
|
|
|
105
105
|
result.extend(self._handle_keyword_types(subkw, indent=indent+1))
|
|
106
106
|
result.append(f"{_indent}END")
|
|
107
107
|
|
|
108
|
+
# GROUP loop
|
|
109
|
+
elif kw_type == "GROUP":
|
|
110
|
+
header = f"{_indent}GROUP"
|
|
111
|
+
if not kw.name == "":
|
|
112
|
+
header += f"{_sd}{kw.name}"
|
|
113
|
+
if hasattr(kw, 'condition') and kw.condition:
|
|
114
|
+
header += f" {kw.condition}"
|
|
115
|
+
result.append(header)
|
|
116
|
+
if hasattr(kw, 'body'):
|
|
117
|
+
for subkw in kw.body:
|
|
118
|
+
result.extend(self._handle_keyword_types(subkw, indent=indent+1))
|
|
119
|
+
result.append(f"{_indent}END")
|
|
120
|
+
|
|
108
121
|
# WHILE loop
|
|
109
122
|
elif kw_type == "WHILE":
|
|
110
123
|
header = f"{_indent}WHILE"
|
|
@@ -134,13 +147,9 @@ class TestCaseParser():
|
|
|
134
147
|
elif kw_type in ("BREAK", "CONTINUE", "RETURN", "ERROR"):
|
|
135
148
|
entry = f"{_indent}{kw_type}"
|
|
136
149
|
if hasattr(kw, 'values') and kw.values:
|
|
137
|
-
entry += f" {
|
|
150
|
+
entry += f" {_sd.join(kw.values)}"
|
|
138
151
|
result.append(entry)
|
|
139
152
|
|
|
140
|
-
# Other types
|
|
141
|
-
elif kw_type in ("COMMENT", "EMPTY"):
|
|
142
|
-
pass
|
|
143
|
-
|
|
144
153
|
# Unknown types
|
|
145
154
|
elif hasattr(kw, 'body'):
|
|
146
155
|
for subkw in kw.body:
|
{robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/parser/testsuiteparser.py
RENAMED
|
@@ -21,7 +21,7 @@ class RobotSuiteParser(SuiteVisitor):
|
|
|
21
21
|
self.suite_counter = 0
|
|
22
22
|
self.suites = []
|
|
23
23
|
self.tests = []
|
|
24
|
-
self.args = CommandLineArguments()
|
|
24
|
+
self.args = CommandLineArguments()
|
|
25
25
|
|
|
26
26
|
def visit_suite(self, suite):
|
|
27
27
|
|
|
@@ -95,13 +95,6 @@ class RobotSuiteParser(SuiteVisitor):
|
|
|
95
95
|
_include = self.args.include
|
|
96
96
|
_exclude = self.args.exclude
|
|
97
97
|
_source = self.args.suite_file
|
|
98
|
-
# Type Conversions
|
|
99
|
-
if type(_include) is not list:
|
|
100
|
-
_include = list(_include)
|
|
101
|
-
if type(_exclude) is not list:
|
|
102
|
-
_exclude = list(_exclude)
|
|
103
|
-
if type(_source) is not list:
|
|
104
|
-
_source = list(_source)
|
|
105
98
|
|
|
106
99
|
# Format / Syntax Conversions
|
|
107
100
|
robot_options = []
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
from .helper.pathconverter import PathConverter
|
|
2
2
|
from .parser.testsuiteparser import RobotSuiteParser
|
|
3
|
-
from .
|
|
3
|
+
from .html.rendering.render import TestDocHtmlRendering
|
|
4
4
|
from .parser.modifier.suitefilemodifier import SuiteFileModifier
|
|
5
5
|
|
|
6
6
|
class TestDoc():
|
|
7
7
|
|
|
8
|
-
def main(self):
|
|
9
|
-
# Convert to correct pathes
|
|
10
|
-
suite_path, output_path, config_path = PathConverter().path_convertion()
|
|
11
|
-
|
|
8
|
+
def main(self):
|
|
12
9
|
# Parse suite object & return complete suite object with all information
|
|
13
10
|
suite_object = RobotSuiteParser().parse_suite()
|
|
14
11
|
|
|
@@ -16,4 +13,4 @@ class TestDoc():
|
|
|
16
13
|
suite_object = SuiteFileModifier().run(suite_object)
|
|
17
14
|
|
|
18
15
|
# Render HTML file
|
|
19
|
-
TestDocHtmlRendering().render_testdoc(suite_object,
|
|
16
|
+
TestDocHtmlRendering().render_testdoc(suite_object, PathConverter().path_convertion())
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass, field
|
|
2
|
-
from typing import Any, List
|
|
3
|
-
from .toml_reader import TOMLReader
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class CommandLineArgumentsData:
|
|
8
|
-
title: str = "Robot Framework - Test Documentation"
|
|
9
|
-
name: str = None
|
|
10
|
-
doc: str = None
|
|
11
|
-
metadata: dict = None
|
|
12
|
-
sourceprefix: str = None
|
|
13
|
-
include: List[str] = field(default_factory=list)
|
|
14
|
-
exclude: List[str] = field(default_factory=list)
|
|
15
|
-
hide_tags: bool = False
|
|
16
|
-
hide_test_doc: bool = False
|
|
17
|
-
hide_suite_doc: bool = False
|
|
18
|
-
hide_source: bool = False
|
|
19
|
-
hide_keywords: bool = False
|
|
20
|
-
config_file: str = None
|
|
21
|
-
verbose_mode: bool = False
|
|
22
|
-
suite_file: str = None
|
|
23
|
-
style: str = None
|
|
24
|
-
html_template: str = "v2"
|
|
25
|
-
output_file: str = None
|
|
26
|
-
colors: dict = None
|
|
27
|
-
|
|
28
|
-
class CommandLineArguments:
|
|
29
|
-
_instance = None
|
|
30
|
-
def __new__(cls):
|
|
31
|
-
if cls._instance is None:
|
|
32
|
-
cls._instance = super().__new__(cls)
|
|
33
|
-
|
|
34
|
-
cls.data = CommandLineArgumentsData()
|
|
35
|
-
return cls._instance
|
|
36
|
-
|
|
37
|
-
###
|
|
38
|
-
### Load configuration file
|
|
39
|
-
###
|
|
40
|
-
def load_from_config_file(self, file_path: str):
|
|
41
|
-
config = TOMLReader()._read_toml(file_path)
|
|
42
|
-
_is_pyproject = self._is_pyproject_config(file_path)
|
|
43
|
-
if _is_pyproject:
|
|
44
|
-
self._handle_pyproject_config(config)
|
|
45
|
-
else:
|
|
46
|
-
self._handle_custom_config(config)
|
|
47
|
-
|
|
48
|
-
###
|
|
49
|
-
### Read pyproject.toml
|
|
50
|
-
###
|
|
51
|
-
def _handle_pyproject_config(self, config: dict[str, Any]):
|
|
52
|
-
testdoc_config = config.get("tool", {}).get("testdoc", {})
|
|
53
|
-
|
|
54
|
-
if "colors" in testdoc_config:
|
|
55
|
-
self.data.colors = testdoc_config["colors"]
|
|
56
|
-
|
|
57
|
-
if "metadata" in testdoc_config:
|
|
58
|
-
if hasattr(self.data, "metadata"):
|
|
59
|
-
setattr(self.data, "metadata", testdoc_config["metadata"])
|
|
60
|
-
|
|
61
|
-
for key, value in testdoc_config.items():
|
|
62
|
-
if key in ("colors", "metadata"):
|
|
63
|
-
continue
|
|
64
|
-
if hasattr(self.data, key):
|
|
65
|
-
setattr(self.data, key, value)
|
|
66
|
-
|
|
67
|
-
###
|
|
68
|
-
### Read custom.toml
|
|
69
|
-
###
|
|
70
|
-
def _handle_custom_config(self, config: dict[str, Any]):
|
|
71
|
-
if "colors" in config:
|
|
72
|
-
self.data.colors = config["colors"]
|
|
73
|
-
|
|
74
|
-
for key, value in config.items():
|
|
75
|
-
if hasattr(self.data, key):
|
|
76
|
-
setattr(self.data, key, value)
|
|
77
|
-
|
|
78
|
-
#####################################################################################
|
|
79
|
-
|
|
80
|
-
def _is_pyproject_config(self, file_path) -> bool:
|
|
81
|
-
return os.path.basename(file_path) == "pyproject.toml"
|
|
82
|
-
|
|
83
|
-
#####################################################################################
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from .cliargs import CommandLineArguments
|
|
4
|
-
from .logger import Logger
|
|
5
|
-
|
|
6
|
-
class PathConverter():
|
|
7
|
-
|
|
8
|
-
def __init__(self):
|
|
9
|
-
self.args = CommandLineArguments().data
|
|
10
|
-
|
|
11
|
-
def path_convertion(self) -> str:
|
|
12
|
-
|
|
13
|
-
suite_path = self.args.suite_file
|
|
14
|
-
output_path = self.args.output_file
|
|
15
|
-
config_path = self.args.config_file
|
|
16
|
-
|
|
17
|
-
# Convert path to suite file / directory
|
|
18
|
-
if type(suite_path) is tuple:
|
|
19
|
-
suite_path = list(suite_path)
|
|
20
|
-
for idx, item in enumerate(suite_path):
|
|
21
|
-
_mod = PathConverter().conv_generic_path(item)
|
|
22
|
-
suite_path[idx] = _mod
|
|
23
|
-
else:
|
|
24
|
-
suite_path = PathConverter().conv_generic_path(path=suite_path)
|
|
25
|
-
|
|
26
|
-
# Convert path to output file
|
|
27
|
-
output_path = PathConverter().conv_generic_path(path=output_path)
|
|
28
|
-
|
|
29
|
-
# Convert path to config file
|
|
30
|
-
if self.args.config_file:
|
|
31
|
-
config_path = PathConverter().conv_generic_path(path=config_path)
|
|
32
|
-
|
|
33
|
-
# Print to console
|
|
34
|
-
if self.args.verbose_mode:
|
|
35
|
-
msg = ""
|
|
36
|
-
if type(suite_path) is not list:
|
|
37
|
-
suite_path = list(suite_path)
|
|
38
|
-
|
|
39
|
-
for item in suite_path:
|
|
40
|
-
if ".robot" in suite_path:
|
|
41
|
-
msg += f'Suite File: "{str(suite_path).split("/")[-1]}"\n'
|
|
42
|
-
else:
|
|
43
|
-
msg += f"Suite Directory: '{suite_path}'\n"
|
|
44
|
-
|
|
45
|
-
Logger().Log("=== TestDoc ===")
|
|
46
|
-
Logger().LogKeyValue("Generating Test Documentation for: ", msg)
|
|
47
|
-
Logger().LogKeyValue("Saving to output file: ", output_path)
|
|
48
|
-
Logger().LogKeyValue("Using config file: ", config_path) if config_path else None
|
|
49
|
-
|
|
50
|
-
return suite_path, output_path, config_path
|
|
51
|
-
|
|
52
|
-
def conv_generic_path(self,
|
|
53
|
-
path: str
|
|
54
|
-
) -> str:
|
|
55
|
-
"""
|
|
56
|
-
Generate OS independent path.
|
|
57
|
-
"""
|
|
58
|
-
abs_path = os.path.abspath(path)
|
|
59
|
-
generic_path = os.path.normpath(abs_path)
|
|
60
|
-
if os.name == "nt":
|
|
61
|
-
generic_path = generic_path.replace("\\", "/")
|
|
62
|
-
return generic_path
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import tomli
|
|
2
|
-
|
|
3
|
-
class TOMLReader():
|
|
4
|
-
|
|
5
|
-
def _read_toml(self, file_path:str):
|
|
6
|
-
try:
|
|
7
|
-
with open(file_path, "rb") as f:
|
|
8
|
-
config = tomli.load(f)
|
|
9
|
-
return config
|
|
10
|
-
except Exception as e:
|
|
11
|
-
raise ImportError(f"Cannot read toml file in: {file_path} with error: \n{e}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/atest/config/config_with_colors.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotframework_testdoc-0.2.4 → robotframework_testdoc-0.2.7}/src/testdoc/html/themes/__init__.py
RENAMED
|
File without changes
|