Skip to content

Commit cddd21a

Browse files
authored
Merge pull request #663 from joonaskuisma/bugfix
Various fixes, improvements, and new --artifacts notimestamps feature
2 parents d214566 + 4f98ea0 commit cddd21a

File tree

10 files changed

+191
-87
lines changed

10 files changed

+191
-87
lines changed

.github/workflows/update-status-label.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
1-
name: Issue and PR Status Labels
1+
name: Issue Status Labels
22

33
on:
44
issues:
55
types: [opened, closed]
6-
pull_request:
7-
types: [closed]
86

97
jobs:
108
update-status:
119
runs-on: ubuntu-latest
1210
permissions:
1311
issues: write
14-
pull-requests: write
1512

1613
steps:
1714
- name: Set up Python (needed by GitHub Actions)
1815
uses: actions/setup-python@v4
1916
with:
2017
python-version: '3.12'
2118

22-
- name: Update issue and PR status
19+
- name: Update issue status
2320
uses: actions/github-script@v6
2421
with:
2522
script: |
2623
const issueLabels = {
2724
open: 'status: open',
28-
completed: 'status: completed',
29-
pr_submitted: 'status: pr submitted',
30-
needs_review: 'status: needs review'
25+
completed: 'status: completed'
3126
};
3227
3328
async function removeOldStatusLabels(issue_number) {
@@ -70,17 +65,3 @@ jobs:
7065
});
7166
}
7267
}
73-
74-
// Handle PR labels only (no external issue modifications)
75-
if (context.eventName === 'pull_request') {
76-
const pr = context.payload.pull_request;
77-
const prNumber = pr.number;
78-
await removeOldStatusLabels(prNumber);
79-
if (context.payload.action === 'closed' && pr.merged) {
80-
await github.rest.issues.addLabels({
81-
...context.repo,
82-
issue_number: prNumber,
83-
labels: [issueLabels.completed]
84-
});
85-
}
86-
}

README.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,16 @@ There are several ways you can help in improving this tool:
7373
- Contribute by programming and making a pull request (easiest way is to work on an issue from the issue tracker)
7474

7575
## Command-line options
76+
<!-- NOTE:
77+
The sections inside these docstring markers are also used in Pabot's --help output.
78+
Currently, the following transformations are applied:
79+
- Remove Markdown links but keep the text
80+
- Remove ** and backticks `
81+
82+
If you modify this part, make sure the Markdown section still looks clean and readable in the --help output. -->
83+
7684
<!-- START DOCSTRING -->
85+
```
7786
pabot [--verbose|--testlevelsplit|--command .. --end-command|
7887
--processes num|--no-pabotlib|--pabotlibhost host|--pabotlibport port|
7988
--processtimeout num|
@@ -85,52 +94,60 @@ pabot [--verbose|--testlevelsplit|--command .. --end-command|
8594
--no-rebot|
8695
--help|--version]
8796
[robot options] [path ...]
97+
```
8898

8999
PabotLib remote server is started by default to enable locking and resource distribution between parallel test executions.
90100

91101
Supports all [Robot Framework command line options](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options) and also following pabot options:
92102

93-
--verbose
103+
**--verbose**
94104
More output from the parallel execution.
95105

96-
--testlevelsplit
106+
**--testlevelsplit**
97107
Split execution on test level instead of default suite level. If .pabotsuitenames contains both tests and suites then
98108
this will only affect new suites and split only them. Leaving this flag out when both suites and tests in
99109
.pabotsuitenames file will also only affect new suites and add them as suite files.
100110

101-
--command [ACTUAL COMMANDS TO START ROBOT EXECUTOR] --end-command
111+
**--command [ACTUAL COMMANDS TO START ROBOT EXECUTOR] --end-command**
102112
RF script for situations where robot is not used directly.
103113

104-
--processes [NUMBER OF PROCESSES]
114+
**--processes [NUMBER OF PROCESSES]**
105115
How many parallel executors to use (default max of 2 and cpu count). Special option "all" will use as many processes as
106116
there are executable suites or tests.
107117

108-
--no-pabotlib
118+
**--no-pabotlib**
109119
Disable the PabotLib remote server if you don't need locking or resource distribution features.
110120

111-
--pabotlibhost [HOSTNAME]
121+
**--pabotlibhost [HOSTNAME]**
112122
Connect to an already running instance of the PabotLib remote server at the given host (disables the local PabotLib
113123
server start). For example, to connect to a remote PabotLib server running on another machine:
114124

115125
pabot --pabotlibhost 192.168.1.123 --pabotlibport 8271 tests/
116126

117-
The remote server can be also started and executed separately from pabot instances:
127+
The remote server can also be started and executed separately from pabot instances:
118128

119129
python -m pabot.pabotlib <path_to_resourcefile> <host> <port>
120130
python -m pabot.pabotlib resource.txt 192.168.1.123 8271
121131

122132
This enables sharing a resource with multiple Robot Framework instances.
123133

124-
--pabotlibport [PORT]
134+
Additional details:
135+
- The default value for --pabotlibhost is 127.0.0.1.
136+
- If you provide a hostname other than 127.0.0.1, the local PabotLib server startup is automatically disabled.
137+
138+
**--pabotlibport [PORT]**
125139
Port number of the PabotLib remote server (default is 8270). See --pabotlibhost for more information.
126140

127-
--processtimeout [TIMEOUT]
141+
Behavior with port and host settings:
142+
- If you set the port value to 0 and --pabotlibhost is 127.0.0.1 (default), a free port on localhost will be assigned automatically.
143+
144+
**--processtimeout [TIMEOUT]**
128145
Maximum time in seconds to wait for a process before killing it. If not set, there's no timeout.
129146

130-
--shard [INDEX]/[TOTAL]
147+
**--shard [INDEX]/[TOTAL]**
131148
Optionally split execution into smaller pieces. This can be used for distributing testing to multiple machines.
132149

133-
--artifacts [FILE EXTENSIONS]
150+
**--artifacts [FILE EXTENSIONS]**
134151
List of file extensions (comma separated). Defines which files (screenshots, videos etc.) from separate reporting
135152
directories would be copied and included in a final report. Possible links to copied files in RF log would be updated
136153
(only relative paths supported). The default value is `png`.
@@ -139,49 +156,51 @@ Supports all [Robot Framework command line options](https://robotframework.org/r
139156

140157
--artifacts png,mp4,txt
141158

142-
--artifactsinsubfolders
159+
The artifact naming conventions are described in the README.md section: [Output Files Generated by Pabot](#output-files-generated-by-pabot).
160+
161+
**--artifactsinsubfolders**
143162
Copy artifacts located not only directly in the RF output dir, but also in it's sub-folders.
144163

145-
--resourcefile [FILEPATH]
164+
**--resourcefile [FILEPATH]**
146165
Indicator for a file that can contain shared variables for distributing resources. This needs to be used together with
147166
pabotlib option. Resource file syntax is same as Windows ini files. Where a section is a shared set of variables.
148167

149-
--argumentfile[INTEGER] [FILEPATH]
168+
**--argumentfile[INTEGER] [FILEPATH]**
150169
Run same suites with multiple [argumentfile](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#argument-files) options.
151170

152171
For example:
153172

154173
--argumentfile1 arg1.txt --argumentfile2 arg2.txt
155174

156-
--suitesfrom [FILEPATH TO OUTPUTXML]
175+
**--suitesfrom [FILEPATH TO OUTPUTXML]**
157176
Optionally read suites from output.xml file. Failed suites will run first and longer running ones will be executed
158177
before shorter ones.
159178

160-
--ordering [FILE PATH]
179+
**--ordering [FILE PATH]**
161180
Optionally give execution order from a file.
162181

163-
--chunk
182+
**--chunk**
164183
Optionally chunk tests to PROCESSES number of robot runs. This can save time because all the suites will share the same
165184
setups and teardowns.
166185

167-
--pabotprerunmodifier [PRERUNMODIFIER MODULE OR CLASS]
186+
**--pabotprerunmodifier [PRERUNMODIFIER MODULE OR CLASS]**
168187
Like Robot Framework's --prerunmodifier, but executed only once in the pabot's main process after all other
169188
--prerunmodifiers. But unlike the regular --prerunmodifier command, --pabotprerunmodifier is not executed again in each
170189
pabot subprocesses. Depending on the intended use, this may be desirable as well as more efficient. Can be used, for
171190
example, to modify the list of tests to be performed.
172191

173-
--no-rebot
192+
**--no-rebot**
174193
If specified, the tests will execute as usual, but Rebot will not be called to merge the logs. This option is designed
175194
for scenarios where Rebot should be run later due to large log files, ensuring better memory and resource availability.
176195
Subprocess results are stored in the pabot_results folder.
177196

178-
--help
197+
**--help**
179198
Print usage instructions.
180199

181-
--version
200+
**--version**
182201
Print version information.
183202

184-
Example usages:
203+
**Example usages:**
185204

186205
pabot test_directory
187206
pabot --exclude FOO directory_to_tests
@@ -398,6 +417,12 @@ Artifacts are **copied** into the output directory and renamed with the followin
398417
TIMESTAMP-ARGUMENT_INDEX-PABOTQUEUEINDEX
399418
```
400419

420+
If you use the special option `notimestamps` at the end of the `--artifacts` command, (For example: `--artifacts png,txt,notimestamps`) the timestamp part will be omitted, and the name will be in the format:
421+
422+
```
423+
ARGUMENT_INDEX-PABOTQUEUEINDEX
424+
```
425+
401426
- **TIMESTAMP** = Time of `pabot` command invocation (not the screenshot's actual timestamp), format: `YYYYmmdd_HHMMSS`
402427
- **ARGUMENT_INDEX** = Optional index number, only used if `--argumentfileN` options are given
403428
- **PABOTQUEUEINDEX** = Process queue index (see section [Global Variables](#global-variables))

src/pabot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
except ImportError:
88
pass
99

10-
__version__ = "5.0.0"
10+
__version__ = "5.1.0"

src/pabot/arguments.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ def _parse_shard(arg):
142142
return int(parts[0]), int(parts[1])
143143

144144

145+
def _parse_artifacts(arg):
146+
# type: (str) -> Tuple[List[str], bool]
147+
artifacts = arg.split(',')
148+
if artifacts[-1] == 'notimestamps':
149+
return (artifacts[:-1], False)
150+
return (artifacts, True)
151+
152+
145153
def _parse_pabot_args(args): # type: (List[str]) -> Tuple[List[str], Dict[str, object]]
146154
pabot_args = {
147155
"command": ["pybot" if ROBOT_VERSION < "3.1" else "robot"],
@@ -155,6 +163,7 @@ def _parse_pabot_args(args): # type: (List[str]) -> Tuple[List[str], Dict[str,
155163
"processes": _processes_count(),
156164
"processtimeout": None,
157165
"artifacts": ["png"],
166+
"artifactstimestamps": True,
158167
"artifactsinsubfolders": False,
159168
"shardindex": 0,
160169
"shardcount": 1,
@@ -181,7 +190,7 @@ def _parse_pabot_args(args): # type: (List[str]) -> Tuple[List[str], Dict[str,
181190
"processtimeout": int,
182191
"ordering": str,
183192
"suitesfrom": str,
184-
"artifacts": lambda x: x.split(","),
193+
"artifacts": _parse_artifacts,
185194
"shard": _parse_shard,
186195
}
187196

@@ -239,6 +248,9 @@ def _parse_pabot_args(args): # type: (List[str]) -> Tuple[List[str], Dict[str,
239248
elif arg_name == "pabotlibhost":
240249
pabot_args["pabotlib"] = False
241250
pabot_args[arg_name] = value
251+
elif arg_name == "artifacts":
252+
pabot_args["artifacts"] = value[0]
253+
pabot_args["artifactstimestamps"] = value[1]
242254
else:
243255
pabot_args[arg_name] = value
244256
i += 2

0 commit comments

Comments
 (0)