Skip to content

Commit

Permalink
test: Test on the real test websites, not mocked
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Nov 7, 2024
1 parent 90284bb commit 15f135d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from os import environ as env, walk
from os.path import join
from uuid import uuid4
from zipfile import ZIP_DEFLATED, ZipFile
from zipfile import ZipFile

import pytest
from aiofiles import open
Expand Down Expand Up @@ -89,25 +89,25 @@ async def test_scrape_page_website(
# Check content is not empty
assert page.content, "Content should not be empty"

# debug: Write Markdown content to file, then rebuild the compressed file
async with open(
encoding="utf-8",
file=join(website_path, f"{website}.md"),
mode="w",
) as f:
await f.write(page.content)
with ZipFile(
compression=ZIP_DEFLATED,
compresslevel=9,
file=join(dir_tests("websites"), f"{website}.zip"),
mode="w",
) as z:
for walk_root, walk_dirs, walk_files in walk(website_path):
for walk_file in walk_files:
z.write(
arcname=walk_file,
filename=join(walk_root, walk_file),
)
# debug: Write Markdown content to file, then rebuild the compressed file, this should be used to generate the test content when upgrading Playwright or pypandoc
# async with open(
# encoding="utf-8",
# file=join(website_path, f"{website}.md"),
# mode="w",
# ) as f:
# await f.write(page.content)
# with ZipFile(
# compression=ZIP_DEFLATED,
# compresslevel=9,
# file=join(dir_tests("websites"), f"{website}.zip"),
# mode="w",
# ) as z:
# for walk_root, walk_dirs, walk_files in walk(website_path):
# for walk_file in walk_files:
# z.write(
# arcname=walk_file,
# filename=join(walk_root, walk_file),
# )

# Check Markdown content
async with open(
Expand Down

0 comments on commit 15f135d

Please sign in to comment.