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

TST: test wuhan on nightly and push to main #152

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 18 additions & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,24 @@
--cov-append \
--cov-report term-missing \
--cov-report xml . \
--env_type ${{ matrix.environment-file }}
--env_type ${{ matrix.environment-file }} \
-m "not wuhan"

- name: run tests (Wuhan)
run: |
pytest \
neatnet/ \
jGaboardi marked this conversation as resolved.
Show resolved Hide resolved
--verbose \
-r a \
--numprocesses logical \
--color yes \
--cov neatnet \
--cov-append \
--cov-report term-missing \
--cov-report xml . \
--env_type ${{ matrix.environment-file }} \
-m wuhan
if: ${{ github.event_name != 'pull_request' }}

- name: zip artifacts - Ubuntu & macOS
run: zip ci_artifacts.zip ci_artifacts -r
Expand Down
13 changes: 7 additions & 6 deletions data/generate_simplified.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
logging.info("")

fua_city = {
1133: "aleppo",
869: "auckland",
4617: "bucaramanga",
809: "douala",
1656: "liege",
4881: "slc",
# 1133: "aleppo",
# 869: "auckland",
# 4617: "bucaramanga",
# 809: "douala",
# 1656: "liege",
# 4881: "slc",
8989: "wuhan",
}

# dict of cityname: fua ID
Expand Down
Binary file added data/wuhan_8989/original.parquet
Binary file not shown.
Binary file added data/wuhan_8989/simplified.parquet
Binary file not shown.
26 changes: 26 additions & 0 deletions neatnet/tests/test_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,29 @@ def test_simplify_network_full_fua(aoi, tol, known_length):
observed.drop(columns=["_status", "geometry"]),
)
pytest.geom_test(known, observed, tolerance=tol, aoi=aoi)


@pytest.mark.wuhan
def test_simplify_network_wuhan(aoi="wuhan_8989", tol=0.3, known_length=4_702_861):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought here would be to have a single helper that runs the guts of this function + test_simplify_network_full_fua() and is called within each. That could also be adapted for test_simplify_network_small(). But that can wait until another PR for sure (if we decide to do).

known = geopandas.read_parquet(full_fua_data / aoi / "simplified.parquet")
observed = neatnet.simplify_network(
geopandas.read_parquet(full_fua_data / aoi / "original.parquet")
)
observed_length = observed.geometry.length.sum()
assert "highway" in observed.columns

# storing GH artifacts
artifact_dir = ci_artifacts / aoi
artifact_dir.mkdir(parents=True, exist_ok=True)
observed.to_parquet(artifact_dir / "simplified.parquet")

assert pytest.approx(observed_length, rel=0.0001) == known_length
assert observed.index.dtype == numpy.dtype("int64")

if pytest.ubuntu and pytest.env_type != "oldest":
assert_series_equal(known["_status"], observed["_status"])
assert_frame_equal(
known.drop(columns=["_status", "geometry"]),
observed.drop(columns=["_status", "geometry"]),
)
pytest.geom_test(known, observed, tolerance=tol, aoi=aoi)
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ filterwarnings = [
# this is an internal warning thrown within ``neatnet.geometry.snap_to_targets()``
'ignore:Could not create a connection*:UserWarning',
]
markers = [
'wuhan:Wuhan takes ages to run'
]
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64", "osx-64", "win-64"]
Expand Down
Loading