Skip to content

Commit

Permalink
Tidy stuff up a little bit. Add coverage to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Nov 19, 2022
1 parent 8f57121 commit e8626b2
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 48 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/archive-bundle.yml

This file was deleted.

62 changes: 52 additions & 10 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ jobs:
name: Checkout
uses: actions/checkout@v3

- id: install
name: Install
uses: ./.github/actions/install
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python=`which python`
shell: bash

- id: lint
name: Lint
Expand All @@ -34,9 +47,22 @@ jobs:
name: Checkout
uses: actions/checkout@v3

- id: install
name: Install Python and dependencies
uses: ./.github/actions/install
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python=`which python`
shell: bash

- id: cache-playwright
name: Cache Playwright
Expand All @@ -54,7 +80,10 @@ jobs:

- id: test
name: Run tests
run: pipenv run xvfb-run pytest tests
run: pipenv run xvfb-run pytest tests -sv --cov
shell: bash
env:
IA_COLLECTION: ${{ secrets.IA_COLLECTION }}

static-type-check:
name: Static type check
Expand All @@ -64,9 +93,22 @@ jobs:
name: Checkout
uses: actions/checkout@v3

- id: install
name: Install
uses: ./.github/actions/install
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python=`which python`
shell: bash

- id: mypy
name: mypy
Expand Down
19 changes: 16 additions & 3 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ jobs:
name: Checkout
uses: actions/checkout@v3

- id: install
name: Install
uses: ./.github/actions/install
- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pipenv'

- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv install --dev --python=`which python`
shell: bash

- id: make
name: Make
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ setuptools-scm = "*"
twine = "*"
xlwt = "*"
pytest-env = "*"
pytest-cov = "*"

[requires]
python_version = "3.9"
95 changes: 85 additions & 10 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

12 changes: 7 additions & 5 deletions tests/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

def test_archive_clean_handle():
"""Test archive handle cleaning."""
assert utils.safe_ia_handle(utils.get_site("latimes")["handle"]) == "latimes"
assert (
utils.safe_ia_handle(utils.get_site("_fiquemsabendo")["handle"])
== "fiquemsabendo"
)

def _get_handle(x):
return utils.safe_ia_handle(utils.get_site(x)["handle"])

assert _get_handle("latimes") == "latimes"
assert _get_handle("_fiquemsabendo") == "fiquemsabendo"
assert _get_handle("CNN") == "cnn"


def test_archive_now_local():
Expand Down

0 comments on commit e8626b2

Please sign in to comment.