Skip to content
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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: CI
on: [pull_request]

jobs:
ci:
uses: ucgmsim/meta-ci-action/.github/workflows/ci.yml@v1
with:
package-dir: workflow
system-packages: "gmt libgmt-dev ghostscript"
enable-coverage: true
cov-package: workflow
cov-fail-under: 95
20 changes: 0 additions & 20 deletions .github/workflows/deptry.yml

This file was deleted.

65 changes: 0 additions & 65 deletions .github/workflows/git-extension.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/numpydoc.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/pytest.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .github/workflows/ruff.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/test-runner.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/types.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/wiki.yml

This file was deleted.

10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ dependencies = [
test = [
"pytest>=6.0.0", # required for the tool.pytest section
"hypothesis[numpy]>=6.0.0",
"pytest-cov", # CI runs pytest --cov
"coverage[toml]", # CI runs coverage report/html
]
types = ["pandas-stubs", "types-geopandas", "types-requests", "scipy-stubs"]
dev = ["ruff", "deptry", "ty", "numpydoc"]
dev = ["ruff>=0.16.5", "deptry", "ty>=0.0.75", "numpydoc"]

[tool.ty.src]
# Generated/dynamic schema definitions that ty cannot usefully analyse.
exclude = ["workflow/schemas.py"]

[tool.deptry]
pep621_dev_dependency_groups = ["test", "dev", "types"]
optional_dependencies_dev_groups = ["test", "dev", "types"]

[project.scripts]
nshm2022-to-realisation = "workflow.scripts.nshm2022_to_realisation:app"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_invocation_of_script(script_module: ModuleType) -> None:
f"Module {script_module.__name__} is missing the 'app' attribute."
)

app = getattr(script_module, "app")
app = script_module.app

assert isinstance(app, Typer), (
f"'app' in {script_module.__name__} should be a Typer instance, but got {type(app)}."
Expand Down
8 changes: 4 additions & 4 deletions tests/test_generate_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_estimate_domain_contains_fault_geometry() -> None:
nz_outline = shapely.box(0, 0, 500000, 500000)

result_domain = generate_domain.estimate_domain(
source_config=source_config, # type: ignore[invalid-argument-type]
source_config=source_config, # ty: ignore[invalid-argument-type]
rrups=rrups,
nz_outline=nz_outline,
fault_buffer=2000.0,
Expand All @@ -89,9 +89,9 @@ def test_generate_domain() -> None:
dip=45.0,
dip_dir=180.0,
)
source_config = SourceConfig(dict(source=source))
magnitudes = Magnitudes(dict(source=magnitude_scaling.BoldM(6.0)))
rakes = Rakes(dict(source=180.0))
source_config = SourceConfig({"source": source})
magnitudes = Magnitudes({"source": magnitude_scaling.BoldM(6.0)})
rakes = Rakes({"source": 180.0})

velocity_model_parameters = VelocityModelParameters(
min_vs=500.0,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_build_hf_input_serialisation() -> None:
shallow_transition_range=1,
deep_depth=2.0,
deep_transition_range=1,
rvfrac_slip_sig=None
rvfrac_slip_sig=None,
)
# Rather than create DomainParameters with a bounding box, we simplify with a mock object
domain = SimpleNamespace(duration=100.0)
Expand All @@ -75,7 +75,7 @@ def test_build_hf_input_serialisation() -> None:
res,
hf_config,
rv,
domain, # type: ignore[invalid-argument-type]
domain, # ty: ignore[invalid-argument-type]
)

lines = result.split("\n")
Expand Down
12 changes: 6 additions & 6 deletions tests/test_realisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# it stays consistent with the codebase.
import json
import struct
from datetime import datetime
from datetime import UTC, datetime
from pathlib import Path
from unittest import mock

Expand Down Expand Up @@ -630,10 +630,10 @@ def test_logtrail_init_empty() -> None:
def test_logtrail_init_with_log_entries() -> None:
"""Test LogTrail initialization with a list of LogEntry objects."""
entry1 = realisations.LogEntry(
utility="util1", args=["a"], version="1", timestamp=datetime.now()
utility="util1", args=["a"], version="1", timestamp=datetime.now(tz=UTC)
)
entry2 = realisations.LogEntry(
utility="util2", args=["b", "c"], timestamp=datetime.now(), version="1"
utility="util2", args=["b", "c"], timestamp=datetime.now(tz=UTC), version="1"
)
trail = realisations.LogTrail(log=[entry1, entry2])
assert trail.log == [entry1, entry2]
Expand All @@ -659,13 +659,13 @@ def test_logtrail_init_with_dicts_post_init() -> None:
"utility": "util1",
"args": ["a"],
"version": "1",
"timestamp": datetime.now().isoformat(),
"timestamp": datetime.now(tz=UTC).isoformat(),
},
{
"utility": "util2",
"args": ["b"],
"version": "1",
"timestamp": datetime.now().isoformat(),
"timestamp": datetime.now(tz=UTC).isoformat(),
},
]
# Pass raw list of dicts
Expand All @@ -692,7 +692,7 @@ def test_logtrail_log_entry_method() -> None:

def test_logtrail_to_dict() -> None:
"""Test converting LogTrail to a dictionary."""
ts = datetime.now()
ts = datetime.now(tz=UTC)
entry1 = realisations.LogEntry(
utility="util1", args=["a"], version="1", timestamp=ts
)
Expand Down
Loading
Loading