Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
  • Loading branch information
barneydobson committed Oct 25, 2024
1 parent bbf43de commit 2cf15a2
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,39 @@

def test_swmmanywhere_cli(tmp_path):
"""Test that the CLI can successfully run with an actual configuration."""

# Define minimum viable config
config = {
"base_dir": str(base_dir),
"project": "my_first_swmm",
"bbox": [1.52740, 42.50524, 1.54273, 42.51259],
}

config_path = base_dir / "config.yml"
with config_path.open("w") as config_file:
yaml.dump(config, config_file)

# Mock sys.argv to simulate command-line arguments
sys.argv = [
"swmmanywhere",
"--config_path",
str(config_path),
"--verbose",
"True",
]

expected = b"No real network provided, returning SWMM .inp file."

with tempfile.NamedTemporaryFile(
suffix=".log", mode="w+b", delete=False
) as temp_file:
fid = Path(temp_file.name)
logger.add(fid)

# Run the CLI entry point
__main__.run()

# Capture the output
assert expected in temp_file.read()
logger.remove()
base_dir = Path(tmp_path)

# Define minimum viable config
config = {
"base_dir": str(base_dir),
"project": "my_first_swmm",
"bbox": [1.52740, 42.50524, 1.54273, 42.51259],
}

config_path = base_dir / "config.yml"
with config_path.open("w") as config_file:
yaml.dump(config, config_file)

# Mock sys.argv to simulate command-line arguments
sys.argv = [
"swmmanywhere",
"--config_path",
str(config_path),
"--verbose",
"True",
]

expected = b"No real network provided, returning SWMM .inp file."

with tempfile.NamedTemporaryFile(
suffix=".log", mode="w+b", delete=False
) as temp_file:
fid = Path(temp_file.name)
logger.add(fid)

# Run the CLI entry point
__main__.run()

# Capture the output
assert expected in temp_file.read()
logger.remove()

0 comments on commit 2cf15a2

Please sign in to comment.