Skip to content

Commit

Permalink
Set minimum version of Gradio and rename height to max_height (#152)
Browse files Browse the repository at this point in the history
* rename to max_height; set minimum gradio version

* add test for explorer launch

* remove redundant wait since communicate does this

* trigger tests

* fix imports

* prevent zombie processes

* skip test if on windows
  • Loading branch information
ejm714 authored Mar 5, 2025
1 parent 62fef8b commit a162aeb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cyfi/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def make_map():
"severity",
]
].style.format({"density_cells_per_ml": "{:,.0f}"}),
height=200,
max_height=200,
)

with gr.Row():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"geopandas",
"geopy",
"GitPython",
"gradio",
"gradio>=5.0",
"lightgbm",
"loguru",
"matplotlib",
Expand Down
31 changes: 29 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import pandas as pd
from pathlib import Path
import platform
import shutil
import signal
import subprocess
import time

import pandas as pd
from pyproj import Transformer
import pytest
from pytest_mock import mocker # noqa: F401
import subprocess
from typer.testing import CliRunner

from cyfi.cli import app
Expand Down Expand Up @@ -255,3 +261,24 @@ def test_python_m_execution():
)
assert result.returncode == 0
assert "Usage: python -m cyfi" in result.stdout


@pytest.mark.skipif(platform.system() == "Windows", reason="SIGINT is not supported on Windows")
def test_cyfi_explorer_launches(tmp_path):
shutil.copy(ASSETS_DIR / "experiment" / "preds.csv", tmp_path / "preds.csv")
shutil.copy(
ASSETS_DIR / "experiment" / "sentinel_metadata_test.csv",
tmp_path / "sentinel_metadata.csv",
)

proc = subprocess.Popen(
["cyfi", "visualize", str(tmp_path)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
time.sleep(10)
proc.send_signal(signal.SIGINT)
stdout, stderr = proc.communicate()
proc.kill() # ensure no zombie processes
assert "Running on" in stdout

0 comments on commit a162aeb

Please sign in to comment.