Skip to content

Commit

Permalink
Merge pull request #66 from GFDRR/pytest
Browse files Browse the repository at this point in the history
Add Python tests and GitHub actions workflow
  • Loading branch information
duncandewhurst authored Jun 26, 2023
2 parents 04e66ca + b1bd6e5 commit eae9dbb
Show file tree
Hide file tree
Showing 19 changed files with 2,727 additions and 2,036 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Run all tests
on: [push, pull_request]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- run: pip install -r requirements.txt
- run: pytest tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.ve
*.swp
*~
tests/__pycache__
28 changes: 28 additions & 0 deletions developer_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,34 @@ python -m http.server --directory _build/html

### Resolve check failures

#### tests

If this check fails, review the output to identify which test failed:

##### test_json.py::test_empty

Review the warnings to identify the empty JSON files and remove the files.

##### test_json.py::test_indent

Run the following command to indent JSON files:

```bash
ocdskit indent -r .
```

##### test_json.py::test_invalid_json

Review the warnings to identify the invalid JSON files and correct the errors.

##### test_schema.py (all tests)

Review the warnings to identify and correct the errors. For more information on each test, see https://jscc.readthedocs.io/en/latest/api/testing/checks.html#module-jscc.testing.checks.

#### test_csv.py

Review the warnings to identify and correct the errors.

#### mdformat

If this check fails, run the following command to fix markdown formatting:
Expand Down
6 changes: 5 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ sphinx-intl
#transifex-client
sphinx_rtd_theme
myst-parser
mdformat-myst
pytest
jscc
ocdskit
mdformat
jsonschema
67 changes: 57 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
#
alabaster==0.7.12
# via sphinx
attrs==23.1.0
# via
# cattrs
# jsonschema
# requests-cache
babel==2.11.0
# via
# sphinx
# sphinx-intl
cattrs==22.2.0
# via requests-cache
certifi==2022.12.7
# via requests
charset-normalizer==2.1.0
Expand All @@ -28,18 +35,35 @@ docutils==0.17.1
# sphinxcontrib-opendataservices-jsonschema
idna==3.4
# via requests
ijson==3.2.0.post0
# via ocdskit
imagesize==1.4.1
# via sphinx
iniconfig==2.0.0
# via pytest
jinja2==3.1.2
# via
# myst-parser
# sphinx
jscc==0.2.2
# via -r requirements.in
json-merge-patch==0.2
# via
# jscc
# ocdsextensionregistry
jsonpointer==2.3
# via
# sphinxcontrib-opendataservices
# sphinxcontrib-opendataservices-jsonschema
jsonref==1.0.1
# via sphinxcontrib-opendataservices-jsonschema
# via
# jscc
# ocdsextensionregistry
# ocdskit
# ocdsmerge
# sphinxcontrib-opendataservices-jsonschema
jsonschema==4.17.3
# via -r requirements.in
livereload==2.6.3
# via sphinx-autobuild
markdown-it-py==2.1.0
Expand Down Expand Up @@ -72,24 +96,43 @@ myst-parser==0.18.1
# -r requirements.in
# sphinxcontrib-opendataservices
# sphinxcontrib-opendataservices-jsonschema
ocdsextensionregistry==0.2.0
# via ocdskit
ocdskit==1.1.5
# via -r requirements.in
ocdsmerge==0.6.6
# via ocdskit
packaging==22.0
# via sphinx
# via
# pytest
# sphinx
platformdirs==3.5.1
# via requests-cache
pluggy==1.0.0
# via pytest
pygments==2.13.0
# via sphinx
pyrsistent==0.19.3
# via jsonschema
pytest==7.3.1
# via -r requirements.in
pytz==2022.6
# via babel
pyyaml==6.0
# via myst-parser
requests==2.28.1
# via sphinx
ruamel-yaml==0.17.32
# via
# mdformat-frontmatter
# mdformat-myst
ruamel-yaml-clib==0.2.7
# via ruamel-yaml
# jscc
# ocdsextensionregistry
# ocdsmerge
# requests-cache
# sphinx
requests-cache==1.0.1
# via ocdsextensionregistry
six==1.16.0
# via livereload
# via
# livereload
# url-normalize
snowballstemmer==2.2.0
# via sphinx
sphinx==5.3.0
Expand Down Expand Up @@ -136,8 +179,12 @@ tornado==6.2
# via livereload
typing-extensions==4.4.0
# via myst-parser
url-normalize==1.4.3
# via requests-cache
urllib3==1.26.11
# via requests
# via
# requests
# requests-cache
wheel==0.40.0
# via sphinx-togglebutton

Expand Down
Loading

0 comments on commit eae9dbb

Please sign in to comment.