Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python testing using pytest and poetry build for dependencies #38

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,7 @@ dmypy.json
.pyre/

# macOS
.DS_Store
.DS_Store

# Poetry
poetry.lock
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ The staging process will also output a summary CSV file with one row for each ti
- If the deduplication method specified in the configuration is `footprints`, the footprint file(s) are provided with a structure that follows the [docs](https://github.com/PermafrostDiscoveryGateway/viz-staging/blob/main/docs/footprints.md).
- In order for logging to work properly, the node running the script that uses this package has a `/tmp` directory so the `log.log` file can populate there.

## Development

Build and test using poetry and pytest.

- To build, run `poetry build`
- To test, run `pytest` from the root of the package directory
- VS Code configuration is setup to configure tests as well
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[tool.poetry]
name = "pdgstaging"
version = "0.9.1"
description = "Geospatial data tiling workflow"
authors = [
"Robyn Thiessen-Bock <[email protected]>",
"Juliet Cohen <[email protected]>",
"Lauren Walker <[email protected]>",
"Matthew B. Jones <[email protected]>",
]
license = 'Apache Software License 2.0'
readme = "README.md"
repository = 'https://github.com/PermafrostDiscoveryGateway/viz-staging'
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
]

[tool.poetry.dependencies]
python = ">=3.9"
numpy = ">=1.2"
pandas = ">=1.4, < 2.0"
shapely = ">= 2, < 3.0"
geopandas = ">= 0.12.2, < 1.0"
morecantile = ">= 3.1, < 4.0"
Rtree = ">= 0.9, < 1.0"
filelock = ">= 3.6, < 4.0"
coloraide = ">= 0.10, < 1"
colormaps = "== 0.4.0"

[tool.poetry.group.dev.dependencies]
pytest = ">=7"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
37 changes: 0 additions & 37 deletions setup.py

This file was deleted.

12 changes: 12 additions & 0 deletions tests/test_loaddata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pandas import DataFrame

def test_init():
"""Initialize tests and show they are working.
"""
assert 1 == 1

def test_load_data():
"""Load example testing data for staging tests.
"""
df = DataFrame( dict( x=[1,2,3], y=[4,5,6] ) )
assert df is not None