Skip to content

Commit b742bf0

Browse files
committed
enhance/fix parsing syslog messages
1 parent e8f67c9 commit b742bf0

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

atest/robot/parsing/caching_libs_and_resources.robot

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Resource atest_resource.robot
44
*** Test Cases ***
55
Import Libraries Only Once
66
[Setup] Run Tests And Set $SYSLOG parsing/library_caching
7-
: FOR ${name} IN Test 1.1 Test 1.2 Test 2.1 Test 2.2
8-
\ Check Test Case ${name}
7+
FOR ${name} IN Test 1.1 Test 1.2 Test 2.1 Test 2.2
8+
Check Test Case ${name}
9+
END
910
Should Contain X Times ${SYSLOG} Imported library 'BuiltIn' with arguments [ ] 1
1011
Should Contain X Times ${SYSLOG} Found test library 'BuiltIn' with arguments [ ] from cache 2
1112
Should Contain X Times ${SYSLOG} Imported library 'OperatingSystem' with arguments [ ] 1
@@ -28,9 +29,10 @@ Process Resource Files Only Once
2829
Check Log Message ${tc.kws[0].kws[2].kws[0].msgs[0]} variable value from 02 resource
2930
Check Log Message ${tc.kws[1].msgs[0]} variable value from 03 resource
3031
${dir} = Normalize Path ${DATADIR}/parsing/resource_parsing
31-
# These messages come twice. Once when they are parsed as test case files and a second time when parsed as resource files.
32-
Should Contain X Times ${SYSLOG} Parsing file '${dir}${/}02_resource.robot' 2
33-
Should Contain X Times ${SYSLOG} Parsing file '${dir}${/}03_resource.robot' 2
32+
Should Contain X Times ${SYSLOG} Parsing file '${dir}${/}02_resource.robot' 1
33+
Should Contain X Times ${SYSLOG} Parsing resource file '${dir}${/}02_resource.robot' 1
34+
Should Contain X Times ${SYSLOG} Parsing file '${dir}${/}03_resource.robot' 1
35+
Should Contain X Times ${SYSLOG} Parsing resource file '${dir}${/}03_resource.robot' 1
3436
# Check that resources were parsed only once
3537
Syslog File Should Contain In Order Parsing directory '${dir}'.
3638
Syslog File Should Contain In Order Parsing file '${dir}${/}01_tests.robot'.

src/robot/running/builder/builders.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def build(self, *paths):
5151
class ResourceFileBuilder(object):
5252

5353
def build(self, path):
54+
LOGGER.info("Parsing resource file '%s'." % path)
5455
data = get_resource_file_ast(path)
5556
return build_resource(data, path)
5657

@@ -123,6 +124,8 @@ def build_suite(source, datapath=None, parent_defaults=None):
123124
#print(ast.dump(ast))
124125
SettingsBuilder(suite, defaults).visit(ast)
125126
SuiteBuilder(suite, defaults).visit(ast)
127+
if not suite.tests:
128+
LOGGER.info("Data source '%s' has no tests or tasks." % datapath)
126129
suite.rpa = _get_rpa_mode(ast)
127130
return suite, defaults
128131

@@ -141,6 +144,8 @@ def build_resource(data, source):
141144
resource = ResourceFile(source=source)
142145
if data.sections:
143146
ResourceBuilder(resource).visit(data)
147+
LOGGER.info("Imported resource file '%s' (%d keywords)."
148+
% (source, len(resource.keywords)))
144149
else:
145150
LOGGER.warn("Imported resource file '%s' is empty." % source)
146151
return resource

0 commit comments

Comments
 (0)