File tree Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ Library SeleniumLibrary
44Library OperatingSystem
55Library Process
66Library String
7+ Library ./logcheck.py
78Library ./ports.py
89
910*** Keywords ***
@@ -70,12 +71,10 @@ Tear Down Everything
7071 Terminate All Processes kill=${True }
7172
7273Lab Log Should Not Contain Known Error Messages
73- ${log } = Get File ${LAB LOG }
74- ${test log } = Set Variable ${log[${PREVIOUS LAB LOG LENGTH }:] }
75- ${length } = Get Length ${log }
76- Set Global Variable ${PREVIOUS LAB LOG LENGTH } ${length }
77- Run Keyword If ("${OS } ", "${PY } ") !\= ("Windows", "36")
78- ... Should Not Contain Any ${test log } @{KNOWN BAD ERRORS }
74+ Touch ${LAB LOG }
75+ ${length } = Get File Size ${LAB LOG }
76+ File Should Not Contain Phrases ${LAB LOG } ${PREVIOUS LAB LOG LENGTH } @{KNOWN BAD ERRORS }
77+ [Teardown] Set Global Variable ${PREVIOUS LAB LOG LENGTH } ${length }
7978
8079Wait For Splash
8180 Go To ${URL } lab?reset&token=${TOKEN }
Original file line number Diff line number Diff line change 1+ import os
2+
3+ from bs4 import UnicodeDammit
4+
5+
6+ def file_should_not_contain_phrases (filename , offset = 0 , * phrases ):
7+ """don't fail _too_ hard if the file can't be read for soem reason"""
8+ with open (filename , "rb" ) as fp :
9+ raw = fp .read ()[offset :]
10+
11+ text = None
12+
13+ try :
14+ text = raw .decode ("utf-8" )
15+ except Exception as err :
16+ text = UnicodeDammit .detwingle (raw ).decode ("utf-8" )
17+
18+ matches = {}
19+
20+ for phrase in phrases :
21+ if phrase in text :
22+ matches [phrase ] = True
23+
24+ assert not matches , "Phrases found in {}: {}" .format (filename , matches )
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ dependencies:
3333 - pytest-runner
3434 - ruamel_yaml
3535 # browser testing
36+ - bs4
3637 - firefox
3738 - geckodriver
38- - robotframework-seleniumlibrary
3939 - robotframework >=3.2
40+ - robotframework-seleniumlibrary
Original file line number Diff line number Diff line change 11# acceptance test dependencies for jupyter_lsp
22-r ./lab.txt
3- robotframework-seleniumlibrary
3+ bs4
44robotframework >=3.2
5+ robotframework-seleniumlibrary
You can’t perform that action at this time.
0 commit comments