⏱️ Duration: 35.49s
❌ Error:
fixturefunc = <function verify_links at 0x7f47769adb40>
request = <FixtureRequest for <Function test_check_links_for_all_pages>>
kwargs = {}
def call_fixture_func(
fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
) -> FixtureValue:
if is_generator(fixturefunc):
fixturefunc = cast(
Callable[..., Generator[FixtureValue, None, None]], fixturefunc
)
generator = fixturefunc(**kwargs)
try:
fixture_result = next(generator)
except StopIteration:
raise ValueError(f"{request.fixturename} did not yield a value") from None
finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
request.addfinalizer(finalizer)
else:
fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
> fixture_result = fixturefunc(**kwargs)
venv/lib/python3.10/site-packages/_pytest/fixtures.py:917:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_links.py:7: in verify_links
check_links(links)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
links = [('https://promo.com/templates', 'Video Templates - Browse Ready-to-Use Templates for Videos'), ('https://promo.com/to...tps://promo.com/blog/video-marketing-101', 'Video Marketing 101: The Complete Guide to Succeed | Promo.com Blog'), ...]
def check_links(links):
"""
Verifies if the status code is correct (expected is 200)
Verifies if page title is correct
At the end it sends a report to Slack, failed tests will contain the list of failed links
"""
failed_links = []
expect_no_links = len(links)
no_of_links = 0
for page_url, page_title in links:
response = requests.get(page_url)
html = bs4.BeautifulSoup(response.content, 'html.parser')