-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bs4 to attempt windows utf-8 reading
- Loading branch information
Showing
4 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
|
||
from bs4 import UnicodeDammit | ||
|
||
|
||
def file_should_not_contain_phrases(filename, offset=0, *phrases): | ||
"""don't fail _too_ hard if the file can't be read for soem reason""" | ||
with open(filename, "rb") as fp: | ||
raw = fp.read()[offset:] | ||
|
||
text = None | ||
|
||
try: | ||
text = raw.decode("utf-8") | ||
except Exception as err: | ||
text = UnicodeDammit.detwingle(raw).decode("utf-8") | ||
|
||
matches = {} | ||
|
||
for phrase in phrases: | ||
if phrase in text: | ||
matches[phrase] = True | ||
|
||
assert not matches, "Phrases found in {}: {}".format(filename, matches) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# acceptance test dependencies for jupyter_lsp | ||
-r ./lab.txt | ||
robotframework-seleniumlibrary | ||
bs4 | ||
robotframework >=3.2 | ||
robotframework-seleniumlibrary |