Skip to content

Commit

Permalink
skip tests with transitive deps on ecoscope core
Browse files Browse the repository at this point in the history
  • Loading branch information
cisaacstern committed Sep 6, 2024
1 parent 250fc62 commit 06226ea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tests/tasks/test_calculate_time_density.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from importlib.resources import files

import geopandas as gpd
import pandas as pd
import pytest

from ecoscope_workflows.tasks.analysis import calculate_time_density


@pytest.mark.requires_ecoscope_core
@pytest.mark.requires_ecoscope_core(transitive_dependencies=["geopandas"])
def test_calculate_time_density():
import geopandas as gpd

example_input_df_path = (
files("ecoscope_workflows.tasks.preprocessing")
/ "relocations-to-trajectory.example-return.parquet"
Expand Down
5 changes: 4 additions & 1 deletion tests/tasks/test_classification.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import matplotlib
import numpy as np
import pandas as pd
import pytest

from ecoscope_workflows.tasks.transformation import color_map


@pytest.mark.requires_ecoscope_core(transitive_dependencies=["matplotlib"])
def test_color_map():
import matplotlib

df = pd.DataFrame({"column_name": ["A", "B", "A", "C", "B", "C"]})
result = color_map(df, "column_name", "viridis")

Expand Down
9 changes: 8 additions & 1 deletion tests/tasks/test_filtering.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pandas as pd
import pytest
from shapely.geometry import Point

from ecoscope_workflows.tasks.transformation._filtering import (
Coordinate,
Expand All @@ -10,6 +9,8 @@

@pytest.fixture
def df_with_geometry():
from shapely.geometry import Point

data = {
"geometry": [
Point(0.0, 0.0),
Expand All @@ -21,7 +22,10 @@ def df_with_geometry():
return pd.DataFrame(data)


@pytest.mark.requires_ecoscope_core(transitive_dependencies=["shapely"])
def test_filter_points(df_with_geometry):
from shapely.geometry import Point

# Sample data fixture (can be replaced with a parametrized fixture)
expected_df = pd.DataFrame(
{
Expand All @@ -42,7 +46,10 @@ def test_filter_points(df_with_geometry):
pd.testing.assert_frame_equal(filtered_df, expected_df)


@pytest.mark.requires_ecoscope_core(transitive_dependencies=["shapely"])
def test_filter_range(df_with_geometry):
from shapely.geometry import Point

# Sample data fixture (can be replaced with a parametrized fixture)
expected_df = pd.DataFrame({"geometry": [Point(-170.0, 80.0)]})

Expand Down
9 changes: 6 additions & 3 deletions tests/tasks/test_preprocessing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from importlib.resources import files

import geopandas as gpd
import pandas as pd
import pytest

Expand All @@ -10,10 +9,11 @@
)
from ecoscope_workflows.tasks.transformation._filtering import Coordinate

pytestmark = pytest.mark.requires_ecoscope_core


@pytest.mark.requires_ecoscope_core(transitive_dependencies=["geopandas"])
def test_process_relocations():
import geopandas as gpd

example_input_df_path = (
files("ecoscope_workflows.tasks.io")
/ "get-subjectgroup-observations.example-return.parquet"
Expand All @@ -36,7 +36,10 @@ def test_process_relocations():
pd.testing.assert_frame_equal(result, cached)


@pytest.mark.requires_ecoscope_core(transitive_dependencies=["geopandas"])
def test_relocations_to_trajectory():
import geopandas as gpd

example_input_df_path = (
files("ecoscope_workflows.tasks.preprocessing")
/ "process-relocations.example-return.parquet"
Expand Down

0 comments on commit 06226ea

Please sign in to comment.