Skip to content

Commit

Permalink
add tests for /statistics endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Oct 16, 2024
1 parent 84e8ad2 commit 8abcf4f
Show file tree
Hide file tree
Showing 11 changed files with 1,028 additions and 985 deletions.
29 changes: 21 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# Development - Contributing

Issues and pull requests are more than welcome: https://github.com/developmentseed/titiler-cmr/issues
Issues and pull requests are more than welcome: <https://github.com/developmentseed/titiler-cmr/issues>

**dev install**

```bash
$ git clone https://github.com/developmentseed/titiler-cmr.git
$ cd titiler-cmr
$ pip install pre-commit -e .["dev,test"]
git clone https://github.com/developmentseed/titiler-cmr.git
cd titiler-cmr
pip install pre-commit -e .["dev,test"]
```

## Linting

This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.

```bash
pre-commit install
```

## Testing

You can then run the tests with the following command:

```sh
python -m pytest --cov titiler.cmr --cov-report term-missing
```bash
python -m pytest
```

This repo is set to use `pre-commit` to run *isort*, *flake8*, *pydocstring*, *black* ("uncompromising Python code formatter") and mypy when committing new code.
The tests use `vcrpy <https://vcrpy.readthedocs.io/en/latest/>`_ to mock API calls
with "pre-recorded" API responses. When adding new tests that incur actual network traffic,
use the ``@pytest.mark.vcr`` decorator function to indicate ``vcrpy`` should be used.
Record the new responses and commit them to the repository.

```bash
$ pre-commit install
python -m pytest -v -s --record-mode new_episodes
```
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ dev = [
"jupyterlab>=4.2.5",
"httpx",
"folium",
"pytest-recording>=0.13.2",
]
test = [
"pytest",
"pytest-cov",
"pytest-asyncio",
"httpx",
"pytest-mock>=3.14.0",
"pytest-recording>=0.13.2",
]

[project.urls]
Expand Down Expand Up @@ -119,5 +120,5 @@ explicit_package_bases = true

[tool.pytest.ini_options]
markers = "vcr: records network activity"

addopts = "-Werror --cov=titiler.cmr --cov-report=term-missing --cov-report=xml"

Loading

0 comments on commit 8abcf4f

Please sign in to comment.