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

Add support for python -m cyfi execution #122

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions cyfi/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from cyfi.cli import app

app(prog_name="python -m cyfi")
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
from pyproj import Transformer
from pytest_mock import mocker # noqa: F401
import subprocess
from typer.testing import CliRunner

from cyfi.cli import app
Expand Down Expand Up @@ -222,3 +223,14 @@ def test_cli_evaluate(tmp_path, evaluate_data_path):
"results.json",
]:
assert (eval_dir / file).exists()


def test_python_m_execution():
result = subprocess.run(
["python", "-m", "cyfi", "--help"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
)
assert result.returncode == 0
assert result.stdout.startswith("Usage: python -m cyfi")