Skip to content

Commit 56789e0

Browse files
jnhyperionJohnny Huang
andauthored
Fix parsing warning of report/ log html file (#2212)
Should not show this warning message if there're report/log html file in the workspace. Co-authored-by: Johnny Huang <[email protected]>
1 parent e3855fe commit 56789e0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/robotide/lib/robot/parsing/htmlreader.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15-
15+
import re
1616
from robotide.lib.robot.output import LOGGER
1717
from robotide.lib.robot.utils import PY2
1818

@@ -54,13 +54,20 @@ def read(self, htmlfile, populator, path=None):
5454
self.state = self.IGNORE
5555
self.current_row = None
5656
self.current_cell = None
57+
58+
report_html_pattern = b'<meta content="Robot Framework .*" name="Generator">'
59+
60+
is_report_html = False
5761
for line in htmlfile.readlines():
5862
self.feed(self._decode(line))
63+
if re.match(report_html_pattern, line):
64+
is_report_html = True
5965
# Calling close is required by the HTMLParser but may cause problems
6066
# if the same instance of our HtmlParser is reused. Currently it's
6167
# used only once so there's no problem.
6268
self.close()
63-
if self.populator.eof():
69+
if self.populator.eof() and not is_report_html:
70+
# Only warn when the html file is not report html
6471
LOGGER.warn("Using test data in HTML format is deprecated. "
6572
"Convert '%s' to plain text format."
6673
% (path or htmlfile.name))

0 commit comments

Comments
 (0)