Skip to content

Commit

Permalink
changed tests according to updated command
Browse files Browse the repository at this point in the history
  • Loading branch information
swaradgat19 committed Aug 15, 2023
1 parent b9b6244 commit afde53f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def test_cli_run_with_registered_models(
],
)
assert result.exit_code == 0
assert (results_dir / "model-outputs").exists()
df = pd.read_csv(results_dir / "model-outputs" / "purple.csv")
assert (results_dir / "model-outputs-csv").exists()
df = pd.read_csv(results_dir / "model-outputs-csv" / "purple.csv")
df_ref = pd.read_csv(reference_csv)

assert set(df.columns) == set(df_ref.columns)
Expand Down Expand Up @@ -141,8 +141,8 @@ def test_cli_run_with_registered_models(
del metadata_path, meta

# Test conversion to geojson.
geojson_dir = results_dir / "geojson"
result = runner.invoke(cli, ["togeojson", str(results_dir), str(geojson_dir)])
geojson_dir = results_dir / "model-outputs-geojson"
# result = runner.invoke(cli, ["togeojson", str(results_dir), str(geojson_dir)])
assert result.exit_code == 0
with open(geojson_dir / "purple.json") as f:
d: geojsonlib.GeoJSON = geojsonlib.load(f)
Expand Down Expand Up @@ -228,8 +228,8 @@ def test_cli_run_with_local_model(tmp_path: Path, tiff_image: Path):
],
)
assert result.exit_code == 0
assert (results_dir / "model-outputs").exists()
df = pd.read_csv(results_dir / "model-outputs" / "purple.csv")
assert (results_dir / "model-outputs-csv").exists()
df = pd.read_csv(results_dir / "model-outputs-csv" / "purple.csv")
df_ref = pd.read_csv(reference_csv)

assert set(df.columns) == set(df_ref.columns)
Expand Down Expand Up @@ -457,8 +457,8 @@ def test_issue_94(tmp_path: Path, tiff_image: Path):
# Important part is that we run through all of the files, despite the unreadble
# file.
assert result.exit_code == 0
assert results_dir.joinpath("model-outputs").joinpath("purple.csv").exists()
assert not results_dir.joinpath("model-outputs").joinpath("bad.csv").exists()
assert results_dir.joinpath("model-outputs-csv").joinpath("purple.csv").exists()
assert not results_dir.joinpath("model-outputs-csv").joinpath("bad.csv").exists()


def test_issue_97(tmp_path: Path, tiff_image: Path):
Expand Down
4 changes: 3 additions & 1 deletion wsinfer/write_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import tqdm
from tqdm.contrib.concurrent import process_map
from functools import partial
import shutil


def _box_to_polygon(
Expand Down Expand Up @@ -84,7 +85,8 @@ def parallelize_geojson(csvs: list, results_dir: Path, num_workers: int) -> None
if not results_dir.exists():
raise FileExistsError(f"results_dir does not exist: {results_dir}")
if output.exists():
raise FileExistsError("Output directory already exists.")
# raise FileExistsError("Output directory already exists.")
shutil.rmtree(f"{output}")
if (
not (results_dir / "model-outputs-csv").exists()
and (results_dir / "patches").exists()
Expand Down

0 comments on commit afde53f

Please sign in to comment.