Commit e8dfb35e authored by Romain Clement's avatar Romain Clement
Browse files

Add tests setup

parent 83f15b2d
name: Test
on: [push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python modules
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pipenv
pipenv install --dev --deploy
- name: Run tests
run: |
pipenv run pytest -v --cov=datasette_dashboards --cov=tests --cov-branch --cov-report=term-missing tests
......@@ -11,9 +11,13 @@ sqlite-utils = "*"
[dev-packages]
black = "~=20.8b1"
datasette-dashboards = {editable = true, path = "."}
pytest = "*"
pytest-asyncio = "*"
pytest-cov = "*"
[requires]
python_version = "3.8"
[pipenv]
allow_prereleases = true
\ No newline at end of file
allow_prereleases = true
This diff is collapsed.
......@@ -23,5 +23,7 @@ setup(
packages=["datasette_dashboards"],
entry_points={"datasette": ["dashboards = datasette_dashboards"]},
install_requires=["datasette"],
extras_require={"test": ["pytest", "pytest-asyncio"]},
tests_require=["datasette-my-plugin[test]"],
package_data={"datasette_dashboards": ["templates/*.html", "static/*"]},
)
import pytest
from datasette.app import Datasette
@pytest.mark.asyncio
async def test_plugin_is_installed():
datasette = Datasette([], memory=True)
response = await datasette.client.get("/-/plugins.json")
assert response.status_code == 200
installed_plugins = {p["name"] for p in response.json()}
assert "datasette-dashboards" in installed_plugins
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment