-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [WIP] 2023.05.19 (#35) * chore: save html when running test_search script * fix: snippet text and knowledge panel content * chore: rename scripts to demo_ to avoid being detected by pytest * chore: bump version * chore: first pass at screenshot-style testing * chore: bump requirements * test: use syrupy * chore: configure boulder, co snapshot * chore: update top stories * chore: add 'complementary results' to knowledge component * chore: update perspectives result classifier * docs: update README with testing info * chore: update video classifying and parsing * test: add new html files to test against * chore: add another snapshot test to the tests file * chore: configure snapshot testing for each html page * test: commit issues in snapshots to git * chore: update subelement parsing * fix: double-counted element * chore: lint * docs: move testing section, add info for testing one file * chore: clean up saving to html * chore: nit, update readme * chore: clean up 2d div flattening * ci: add pytest github action * chore: punt on triple news component * chore: stop tracking html and json files see #38
- Loading branch information
1 parent
3c8955e
commit e22eeca
Showing
18 changed files
with
186 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Snapshot Testing | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Insall WebSearcher | ||
run: | | ||
pip install -e . | ||
- name: Run pytest | ||
run: | | ||
pytest --snapshot-warn-unused |
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
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
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
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
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
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 |
---|---|---|
|
@@ -13,3 +13,5 @@ six==1.16.0 | |
soupsieve==2.2.1 | ||
tldextract==3.1.0 | ||
urllib3==1.26.5 | ||
pytest==7.3.1 | ||
syrupy==4.0.2 |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ def get_readme_descriptions(fp='README.md', s='#', stop_at=2): | |
|
||
setuptools.setup( | ||
name='WebSearcher', | ||
version='2022.07.08-a', | ||
version='2023.05.19', | ||
url='http://github.com/gitronald/WebSearcher', | ||
author='Ronald E. Robertson', | ||
author_email='[email protected]', | ||
|
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,29 @@ | ||
import pytest | ||
import glob | ||
import WebSearcher as ws | ||
|
||
from syrupy.extensions.json import JSONSnapshotExtension | ||
|
||
@pytest.fixture | ||
def snapshot_json(snapshot): | ||
return snapshot.use_extension(JSONSnapshotExtension) | ||
|
||
def pytest_generate_tests(metafunc): | ||
file_list = glob.glob('./tests/html_pages/*.html') | ||
metafunc.parametrize("file_name", file_list ) | ||
|
||
def test_parsing(snapshot_json, file_name): | ||
# read html | ||
with open(file_name) as file: | ||
html = file.read() | ||
|
||
# Initialize crawler | ||
se = ws.SearchEngine() | ||
|
||
# Conduct Search | ||
se.mock_search(html) | ||
|
||
# Parse Results | ||
se.parse_results() | ||
|
||
assert se.results == snapshot_json |