Skip to content

Commit

Permalink
test: drop unused strategies and remove 'mock' from naming convention…
Browse files Browse the repository at this point in the history
… to avoid confusion with pytest fixtures
  • Loading branch information
ewagner-verta committed Aug 22, 2023
1 parent 1a1f826 commit 692c369
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 53 deletions.
2 changes: 0 additions & 2 deletions client/verta/tests/unit_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
from typing import Any, Callable, Dict, List
from unittest.mock import patch

import hypothesis.strategies as st
import pytest
import responses

from tests.unit_tests.strategies import mock_pipeline_definition
from verta._internal_utils._utils import Configuration, Connection
from verta._protos.public.registry import RegistryService_pb2 as _RegistryService
from verta.client import Client
Expand Down
4 changes: 2 additions & 2 deletions client/verta/tests/unit_tests/pipeline/test_pipeline_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from hypothesis import given, HealthCheck, settings

from tests.unit_tests.strategies import mock_pipeline_definition
from tests.unit_tests.strategies import pipeline_definition
from verta.pipeline import PipelineGraph


Expand All @@ -22,7 +22,7 @@ def test_set_steps(make_mock_pipeline_step) -> None:
assert not graph.steps


@given(pipeline_definition=mock_pipeline_definition())
@given(pipeline_definition=pipeline_definition())
@settings(
suppress_health_check=[HealthCheck.function_scoped_fixture],
deadline=None,
Expand Down
4 changes: 2 additions & 2 deletions client/verta/tests/unit_tests/pipeline/test_pipeline_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

from hypothesis import given, HealthCheck, settings

from tests.unit_tests.strategies import mock_pipeline_definition
from tests.unit_tests.strategies import pipeline_definition
from verta.pipeline import PipelineStep


@given(pipeline_definition=mock_pipeline_definition())
@given(pipeline_definition=pipeline_definition())
@settings(
suppress_health_check=[HealthCheck.function_scoped_fixture],
deadline=None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from hypothesis import given, HealthCheck, settings

from tests.unit_tests.strategies import mock_pipeline_definition
from tests.unit_tests.strategies import pipeline_definition
from verta.pipeline import RegisteredPipeline


Expand All @@ -24,7 +24,7 @@ def test_copy_graph(
assert copied_graph is not graph # different objects


@given(pipeline_definition=mock_pipeline_definition())
@given(pipeline_definition=pipeline_definition())
@settings(
suppress_health_check=[HealthCheck.function_scoped_fixture],
deadline=None,
Expand Down
46 changes: 1 addition & 45 deletions client/verta/tests/unit_tests/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def mock_workspace(draw):


@st.composite
def mock_pipeline_definition(draw):
def pipeline_definition(draw):
"""Generate a mocked pipeline specification dictionary"""

# step names in a pipeline must be unique
Expand Down Expand Up @@ -311,47 +311,3 @@ def mock_pipeline_definition(draw):
},
],
}


@st.composite
def mock_pipeline_resources_dict(draw):
"""Generate a mocked pipeline resources dictionary"""
return {
"resources": {
"cpu_millis": draw(st.integers(min_value=1)),
"memory": draw(st.text(min_size=1)),
"nvidia_gpu": {
"model": draw(st.enums("T4", "V100")),
"number": draw(st.integers(min_value=1, max_value=1000)),
},
}
}


@st.composite
def mock_pipeline_step_configuration(draw):
"""Generate a mocked pipeline step configuration dictionary"""
return {
"build_id": draw(st.integers(min_value=1)),
"env": draw(
st.dictionaries(
keys=st.text(min_size=1),
values=st.text(min_size=1),
min_size=1,
)
),
"resources": mock_pipeline_resources_dict(),
"name": draw(st.text(min_size=1)),
}


@st.composite
def mock_pipeline_configuration(draw):
"""Generate a mocked pipeline step configuration dictionary with Kafka settings"""
return {
"pipeline_version_id": draw(st.integers(min_value=1)),
"steps": [
mock_pipeline_step_configuration(),
mock_pipeline_step_configuration(),
],
}

1 comment on commit 692c369

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker Tag: VRD-894_pipelines_CRUD-2023-08-22T10-27-57--692c369

Please sign in to comment.