Skip scraper tests when webengine is known to fail

This commit is contained in:
Kovid Goyal 2022-04-02 07:21:26 +05:30
parent a0c0bd7af9
commit fbb0956665
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -218,7 +218,14 @@ def find_tests():
import unittest
from lxml.html import fromstring, tostring
import re
skip = ''
is_sanitized = 'libasan' in os.environ.get('LD_PRELOAD', '')
if is_sanitized:
skip = 'Skipping Scraper tests as ASAN is enabled'
elif 'SKIP_QT_BUILD_TEST' in os.environ:
skip = 'Skipping Scraper tests as it causes crashes in macOS VM'
@unittest.skipIf(skip, skip)
class TestSimpleWebEngineScraper(unittest.TestCase):
def test_dom_load(self):
@ -231,7 +238,9 @@ def find_tests():
def c(a):
ans = tostring(fromstring(a.encode('utf-8')), pretty_print=True, encoding='unicode')
return re.sub(r'\s+', ' ', ans)
self.assertEqual(c(html), c(open(path, 'rb').read().decode('utf-8')))
with open(path, 'rb') as f:
raw = f.read().decode('utf-8')
self.assertEqual(c(html), c(raw))
self.assertRaises(ValueError, overseer.fetch_url, 'test', 'file:///does-not-exist.html')
w = overseer.workers
self.assertEqual(len(w), 1)