Skip to content

Commit 594ba01

Browse files
committed
Explicitly deprecated --critical and --noncritical.
Mention in the deprecation warning that they have no effect with Rebot.
1 parent 23b12b0 commit 594ba01

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
lines changed

atest/robot/cli/rebot/invalid_usage.robot

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
*** Settings ***
22
Resource rebot_cli_resource.robot
3-
Suite Setup Run tests to create input file for Rebot
3+
Suite Setup Run tests to create input file for Rebot misc/pass_and_fail.robot ${INPUT}
44
Test Template Rebot Should Fail
55

6+
*** Variables ***
7+
${INPUT} %{TEMPDIR}/input-for-cli-rebot-invalid-usage.xml
8+
69
*** Test Cases ***
710
Invalid Options
811
option --invalid not recognized --invalid option
@@ -47,9 +50,20 @@ Invalid --RemoveKeywords
4750
Invalid value for option '--removekeywords'. Expected 'ALL', 'PASSED', 'NAME:<pattern>', 'TAG:<pattern>', 'FOR', or 'WUKS' but got 'Invalid'.
4851
... --removekeywords wuks --removek name:xxx --RemoveKeywords Invalid
4952

53+
--critical and --noncritical are deprecated
54+
[Template] NONE
55+
${result} = Run Rebot --critical pass --noncritical fail ${INPUT}
56+
${messsage} = Catenate
57+
... Command line options --critical and --noncritical have been deprecated and have no effect with Rebot.
58+
... Use --skiponfailure when starting execution instead.
59+
Should Be Equal ${result.stderr} [ WARN ] ${messsage}
60+
Should Be Equal As Integers ${result.rc} 1
61+
Check Test Case Pass
62+
Check Test Case Fail
63+
5064
*** Keywords ***
5165
Rebot Should Fail
52-
[Arguments] ${error} ${options}= ${source}=${INPUTFILE}
66+
[Arguments] ${error} ${options}= ${source}=${INPUT}
5367
${result} = Run Rebot ${options} ${source} default options= output=
5468
Should Be Equal As Integers ${result.rc} 252
5569
Should Be Empty ${result.stdout}

atest/robot/output/xunit.robot

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ Invalid XUnit File
6161

6262
Skipping non-critical tests is deprecated
6363
Run tests --xUnit xunit.xml --xUnitSkipNonCritical ${PASS AND FAIL}
64-
Stderr Should Contain Command line option --xunitskipnoncritical has been deprecated.
65-
64+
Stderr Should Contain Command line option --xunitskipnoncritical has been deprecated and has no effect.
6665

6766
*** Keywords ***
6867
Get XUnit Node

atest/robot/rebot/xunit.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Times in xUnit output
3939

4040
XUnit skip non-criticals is deprecated
4141
Run Rebot --xUnit xunit.xml --xUnitSkipNonCritical ${INPUT FILE}
42-
Stderr Should Contain Command line option --xunitskipnoncritical has been deprecated.
42+
Stderr Should Contain Command line option --xunitskipnoncritical has been deprecated and has no effect.
4343

4444
Invalid XUnit File
4545
Create Directory ${INVALID}

src/robot/rebot.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,9 @@
124124
--processemptysuite Processes output also if the top level suite is
125125
empty. Useful e.g. with --include/--exclude when it
126126
is not an error that there are no matches.
127-
-c --critical tag * Tests having the given tag are considered critical.
128-
If no critical tags are set, all tests are critical.
129-
Tags can be given as a pattern same way as with
130-
--include.
131-
-n --noncritical tag * Tests having the given tag are not critical even if
132-
they have a tag set with --critical. Tag can be
133-
a pattern.
127+
-c --critical tag * Deprecated since RF 4.0 and has no effect anymore.
128+
-n --noncritical tag * Deprecated since RF 4.0 and has no effect anymore.
129+
Use --skiponfailure when starting execution instead.
134130
-d --outputdir dir Where to create output files. The default is the
135131
directory where Rebot is run from and the given path
136132
is considered relative to that unless it is absolute.
@@ -145,7 +141,7 @@
145141
similarly as --log. Default: report.html
146142
-x --xunit file xUnit compatible result file. Not created unless this
147143
option is specified.
148-
--xunitskipnoncritical *Deprecated* since Robot Framework 4.0.
144+
--xunitskipnoncritical Deprecated since RF 4.0 and has no effect anymore.
149145
-T --timestampoutputs When this option is used, timestamp in a format
150146
`YYYYMMDD-hhmmss` is added to all generated output
151147
files between their basename and extension. For
@@ -339,8 +335,13 @@ def __init__(self):
339335
def main(self, datasources, **options):
340336
settings = RebotSettings(options)
341337
LOGGER.register_console_logger(**settings.console_output_config)
338+
if settings['Critical'] or settings['NonCritical']:
339+
LOGGER.warn("Command line options --critical and --noncritical have been "
340+
"deprecated and have no effect with Rebot. Use --skiponfailure "
341+
"when starting execution instead.")
342342
if settings['XUnitSkipNonCritical']:
343-
LOGGER.warn("Command line option --xunitskipnoncritical has been deprecated.")
343+
LOGGER.warn("Command line option --xunitskipnoncritical has been "
344+
"deprecated and has no effect.")
344345
LOGGER.disable_message_cache()
345346
rc = ResultWriter(*datasources).write_results(settings)
346347
if rc < 0:

src/robot/run.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,12 @@
142142
--runemptysuite Executes suite even if it contains no tests. Useful
143143
e.g. with --include/--exclude when it is not an error
144144
that no test matches the condition.
145-
-c --critical tag * Tests having the given tag are considered critical.
146-
If no critical tags are set, all tests are critical.
147-
Tags can be given as a pattern same way as with
148-
--include.
149-
-n --noncritical tag * Tests having the given tag are not critical even if
150-
they have a tag set with --critical. Tag can be
145+
--skip tag * Tests having given tag will be skipped. Tag can be
151146
a pattern.
152-
--skip tag * Tests having given tag will be skipped.Tag can be
153-
a pattern.
154-
--skiponfailure tag * Tests having given tag will have status 'SKIP'
155-
instead of 'FAIL' if they fail. Tag can be a pattern.
147+
--skiponfailure tag * Tests having given tag will be marked skipped if
148+
they fail. New in RF 4.0.
149+
-n --noncritical tag * Alias for --skiponfailure. Deprecated since RF 4.0.
150+
-c --critical tag * Opposite of --noncritical. Deprecated since RF 4.0.
156151
-v --variable name:value * Set variables in the test data. Only scalar
157152
variables with string value are supported and name is
158153
given without `${}`. See --variablefile for a more
@@ -184,7 +179,7 @@
184179
similarly as --log. Default: report.html
185180
-x --xunit file xUnit compatible result file. Not created unless this
186181
option is specified.
187-
--xunitskipnoncritical Mark non-critical tests in xUnit output as skipped.
182+
--xunitskipnoncritical Deprecated since RF 4.0 and has no effect anymore.
188183
-b --debugfile file Debug file written during execution. Not created
189184
unless this option is specified.
190185
-T --timestampoutputs When this option is used, timestamp in a format
@@ -429,8 +424,12 @@ def __init__(self):
429424
def main(self, datasources, **options):
430425
settings = RobotSettings(options)
431426
LOGGER.register_console_logger(**settings.console_output_config)
427+
if settings['Critical'] or settings['NonCritical']:
428+
LOGGER.warn("Command line options --critical and --noncritical have been "
429+
"deprecated. Use --skiponfailure instead.")
432430
if settings['XUnitSkipNonCritical']:
433-
LOGGER.warn("Command line option --xunitskipnoncritical has been deprecated.")
431+
LOGGER.warn("Command line option --xunitskipnoncritical has been "
432+
"deprecated and has no effect.")
434433
LOGGER.info('Settings:\n%s' % unic(settings))
435434
builder = TestSuiteBuilder(settings['SuiteNames'],
436435
included_extensions=settings.extension,

0 commit comments

Comments
 (0)