Skip to content

Commit

Permalink
Setup testing (#67)
Browse files Browse the repository at this point in the history
* fix tutorials paths in gitignore

* fix step-1 resolve deprecation warnings

* run step_2, remove deprecations including dict structure for CRS

* get Step 3 working

* fix examples notebooks

* fix crs in doc-strings and as defaults to str

* reduce number of paths for example speed

* lengthen timeout for docs to run

* text, formatting for step-1 tutorial

* formatting step-2 tutorial

* formatting for step-3 notebook

* update example_finding notebook

* fix doc-strings ex-fixing

* update ex gravity notebook

* start testing

* placeholder tests

* add tests

* one more test, coverage to 9%

* try miniconda ci

* non-interactive conda install

* try to fix ci job

* specify coverage rcfile

* dont report coverage for now

* remove flag

* add tests

* add tests

* core funcs and tests

* finish tests for calculate_od_raw

* more tests

* add integrated test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more tests and edits for new networkx versions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add tests

* stop building on macos

* add test

* updates

* fix and test for length of multilinesegment

* more tests, use sample data in tests

* more tests and fixes to core fcts

* add test

* cleanup tests, test isochrone function

* more tests and edits to core functions

* more testing of core functions

* add more tests

* more tests, up to 70% test coverage

* add more tests

* minor edits

* clean up tests a bit, add pooch for some data

* remove cov report

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
elbeejay and pre-commit-ci[bot] authored Jul 29, 2024
1 parent c2ed011 commit e6a3c43
Show file tree
Hide file tree
Showing 23 changed files with 39,934 additions and 822 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8"]
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: tests

on:
push:
pull_request:

jobs:
ubuntu-build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
env:
OS: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: false
activate-environment: test-env
auto-activate-base: false
- name: Install dependencies then test
run: |
conda install -c conda-forge gdal
conda install -c conda-forge pip
pip install .[dev]
coverage run -m pytest
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["pre-commit", "pytest", "pytest-cov", "tomli", "GOStnets[docs,osm,opt]"]
dev = ["pre-commit", "pytest", "pytest-cov", "tomli", "coverage[toml]", "GOStnets[docs,osm,opt]", "pooch"]
docs = [
"docutils==0.17.1",
"jupyter-book>=1,<2",
"sphinxcontrib-apidoc>=0.4.0,<1",
"jupyter-cache>=0.6.0",
"nbconvert",
]
osm = ["gdal", "geopy", "boltons"]
osm = ["gdal"]
opt = ["pulp"]

[project.urls]
Expand All @@ -66,3 +66,12 @@ convention = "numpy"

[tool.ruff]
exclude = ["__init__.py"]

[tool.coverage.run]
omit = [
"tests/*",
"docs/*",
"Tutorials/*",
"src/GOSTnets/_version.py",
"src/GOSTnets/__init__.py",
]
2 changes: 1 addition & 1 deletion src/GOSTnets/calculate_od_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def calculateOD_gdf(
destinations["OD_D"] = destinations["NN"].apply(
lambda x: np.where(dNodes == x)[0][0]
)
outputMatrix = od[origins["OD_O"].values, :][:, destinations["OD_D"].values]
outputMatrix = od[origins["OD_O"].values][destinations["OD_D"].values]
if calculate_snap:
originsUTM = pandana_snap(G, origins, target_crs="epsg:3857")
destinationsUTM = pandana_snap(G, destinations, target_crs="epsg:3857")
Expand Down
2 changes: 2 additions & 0 deletions src/GOSTnets/conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def rasterize_od_results(inD, outFile, field, template=None):
path to save output raster
field : string
field to rasterize
template : string, optional
path to raster template file, by default None
Returns
-------
Expand Down
Loading

0 comments on commit e6a3c43

Please sign in to comment.