Skip to content

Commit 1a38a7a

Browse files
committed
Update and clean up Snakefiles and integration_test.
1 parent b9291a6 commit 1a38a7a

5 files changed

Lines changed: 10 additions & 35 deletions

File tree

tests/integration/Snakefile

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,20 @@
22
configfile: workflow.source_path("./test_config.yaml")
33

44

5-
# Import the module and configure it.
6-
# `snakefile:` specifies the module. It can use file paths and special github(...) / gitlab(...) markers
7-
# `config`: specifies the module configuration.
8-
# `pathvars:` helps you re-wire where the module places files.
95
module grid_builder:
106
pathvars:
11-
# Redirect OSM outputs
12-
osm_out="resources/module/resources/automatic/osm/out",
13-
# Redirect intermediate files that are internal to the module
14-
logs="resources/module/logs",
15-
resources="resources/module/resources",
16-
results="resources/module/results",
7+
resources="resources/grid-builder",
8+
logs="logs/grid-builder",
179
snakefile:
1810
"../../workflow/Snakefile"
1911
config:
2012
config["grid_builder"]
2113

2214

23-
# rename all module rules with a prefix, to avoid naming conflicts.
2415
use rule * from grid_builder as grid_builder_*
2516

2617

27-
# Request OSM retrieval outputs from the module
2818
rule all:
2919
default_target: True
3020
input:
31-
expand(
32-
"resources/module/resources/automatic/osm/out/{country}_{feature}.{ext}",
33-
country="belgium",
34-
feature=["substation", "line"],
35-
ext=["csv", "geojson"],
36-
),
37-
message:
38-
"Retrieve OSM grid data by country and feature."
21+
rules.grid_builder_retrieve_osm_all.input,

tests/integration/test_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
grid_builder:
22
countries:
3-
- belgium
3+
- benin
44

55
retrieve:
66
source: geofabrik
@@ -12,4 +12,4 @@ grid_builder:
1212
mp: true
1313
stream_backend: true
1414
cache_primary: false
15-
target_date: null
15+
target_date:

tests/integration_test.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ def test_standard_file_existance(module_path, file):
4040
assert Path(module_path / file).exists()
4141

4242

43-
def test_snakemake_all_failure(module_path):
44-
"""The snakemake 'all' rule should return an error by default."""
45-
process = subprocess.run(
46-
"snakemake --cores 1", shell=True, cwd=module_path, capture_output=True
47-
)
48-
assert "INVALID (missing locally)" in str(process.stderr)
49-
50-
5143
def test_snakemake_integration_testing(module_path):
5244
"""Run a light-weight test simulating someone using this module."""
5345
assert subprocess.run(

workflow/Snakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ min_version("9.19")
1212
# Define pathvars to expose OSM retrieval outputs for downstream use.
1313
pathvars:
1414
# OSM retrieval outputs by country and feature
15-
osm_out="<resources>/automatic/osm/out",
15+
osm_out="<resources>/osm/out",
1616

1717

1818
# Default configuration file generated from pydantic schema.

workflow/rules/retrieve.smk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
rule retrieve_osm:
77
output:
88
csv=expand(
9-
"<resources>/automatic/osm/out/{country}_{feature}.csv",
9+
"<resources>/osm/out/{country}_{feature}.csv",
1010
country="{country}",
1111
feature=config["retrieve"]["features"],
1212
),
1313
geojson=expand(
14-
"<resources>/automatic/osm/out/{country}_{feature}.geojson",
14+
"<resources>/osm/out/{country}_{feature}.geojson",
1515
country="{country}",
1616
feature=config["retrieve"]["features"],
1717
),
@@ -37,12 +37,12 @@ rule retrieve_osm:
3737
rule retrieve_osm_all:
3838
input:
3939
csv=expand(
40-
"<resources>/automatic/osm/out/{country}_{feature}.csv",
40+
"<resources>/osm/out/{country}_{feature}.csv",
4141
country=config["countries"],
4242
feature=config["retrieve"]["features"],
4343
),
4444
geojson=expand(
45-
"<resources>/automatic/osm/out/{country}_{feature}.geojson",
45+
"<resources>/osm/out/{country}_{feature}.geojson",
4646
country=config["countries"],
4747
feature=config["retrieve"]["features"],
4848
),

0 commit comments

Comments
 (0)