Mirror of https://github.com/roostorg/osprey github.com/roostorg/osprey
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(engine): migrate remaining tests to new udf import paths (#20)

authored by

Caidan and committed by
GitHub
c0d60de8 2f80e4ee

+266 -308
+1 -2
osprey_worker/src/osprey/engine/ast_validator/tests/test_validation_context.py
··· 1 1 import pytest 2 - 3 - from ...conftest import CheckFailureFunction, RunValidationFunction 2 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 4 3 5 4 pytestmark = [pytest.mark.use_validators([])] 6 5
+2 -3
osprey_worker/src/osprey/engine/ast_validator/tests/test_validation_context_warnings.py
··· 1 1 import pytest 2 2 from osprey.engine.ast.ast_utils import filter_nodes 3 3 from osprey.engine.ast.grammar import Source, String 4 - 5 - from ...conftest import CheckFailureFunction, CheckOutputFunction, RunValidationFunction 6 - from ..base_validator import SourceValidator 4 + from osprey.engine.ast_validator.base_validator import SourceValidator 5 + from osprey.engine.conftest import CheckFailureFunction, CheckOutputFunction, RunValidationFunction 7 6 8 7 9 8 class WarnOnStringLiteralsThatContainJake(SourceValidator):
+4 -5
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_feature_name_to_entity_type_mapping.py
··· 1 1 import pytest 2 - 3 - from ....conftest import RunValidationFunction 4 - from ..feature_name_to_entity_type_mapping import FeatureNameToEntityTypeMapping 5 - from ..unique_stored_names import UniqueStoredNames 6 - from ..validate_call_kwargs import ValidateCallKwargs 2 + from osprey.engine.ast_validator.validators.feature_name_to_entity_type_mapping import FeatureNameToEntityTypeMapping 3 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 4 + from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 + from osprey.engine.conftest import RunValidationFunction 7 6 8 7 pytestmark = [ 9 8 pytest.mark.use_validators([FeatureNameToEntityTypeMapping, ValidateCallKwargs, UniqueStoredNames]),
+9 -8
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_imports_must_not_have_cycles.py
··· 1 1 from typing import Any, Callable, List 2 2 3 3 import pytest 4 - 5 - from ....conftest import CheckFailureFunction, RunValidationFunction 6 - from ....osprey_stdlib.udfs.import_ import Import 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..imports_must_not_have_cycles import ImportsMustNotHaveCycles 9 - from ..unique_stored_names import UniqueStoredNames 10 - from ..validate_call_kwargs import ValidateCallKwargs 11 - from ..validate_dynamic_calls_have_annotated_rvalue import ValidateDynamicCallsHaveAnnotatedRValue 4 + from osprey.engine.ast_validator.validators.imports_must_not_have_cycles import ImportsMustNotHaveCycles 5 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 6 + from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 7 + from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 8 + ValidateDynamicCallsHaveAnnotatedRValue, 9 + ) 10 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 11 + from osprey.engine.stdlib.udfs.import_ import Import 12 + from osprey.engine.udf.registry import UDFRegistry 12 13 13 14 pytestmark: List[Callable[[Any], Any]] = [ 14 15 pytest.mark.use_validators(
+2 -3
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_no_unused_locals.py
··· 1 1 import pytest 2 - 3 - from ....conftest import CheckFailureFunction, RunValidationFunction 4 - from ..no_unused_locals import NoUnusedLocals 2 + from osprey.engine.ast_validator.validators.no_unused_locals import NoUnusedLocals 3 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 5 4 6 5 pytestmark = pytest.mark.use_validators([NoUnusedLocals]) 7 6
+2 -3
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_unique_stored_names.py
··· 1 1 import pytest 2 - 3 - from ....conftest import CheckFailureFunction, RunValidationFunction 4 - from ..unique_stored_names import UniqueStoredNames 2 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 3 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 5 4 6 5 pytestmark = pytest.mark.use_validators([UniqueStoredNames]) 7 6
+8 -9
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_validate_call_kwargs.py
··· 3 3 from typing import Any, Callable, Dict, List, Type 4 4 5 5 import pytest 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 - from ....osprey_executor.execution_context import ExecutionContext 9 - from ....osprey_udf.arguments import ArgumentsBase, ConstExpr 10 - from ....osprey_udf.base import UDFBase 11 - from ....osprey_udf.registry import UDFRegistry 12 - from ...validation_context import ValidationContext 13 - from ..unique_stored_names import UniqueStoredNames 14 - from ..validate_call_kwargs import ValidateCallKwargs 6 + from osprey.engine.ast_validator.validation_context import ValidationContext 7 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 8 + from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 9 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 10 + from osprey.engine.executor.execution_context import ExecutionContext 11 + from osprey.engine.udf.arguments import ArgumentsBase, ConstExpr 12 + from osprey.engine.udf.base import UDFBase 13 + from osprey.engine.udf.registry import UDFRegistry 15 14 16 15 pytestmark: List[Callable[[Any], Any]] = [ 17 16 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+6 -7
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_validate_call_rvalue.py
··· 1 1 from typing import Any, Callable, List 2 2 3 3 import pytest 4 - 5 - from ....conftest import CheckFailureFunction, RunValidationFunction 6 - from ....osprey_udf.arguments import ArgumentsBase 7 - from ....osprey_udf.base import UDFBase 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..unique_stored_names import UniqueStoredNames 10 - from ..validate_call_rvalue import ValidateCallRValue 4 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 + from osprey.engine.ast_validator.validators.validate_call_rvalue import ValidateCallRValue 6 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 7 + from osprey.engine.udf.arguments import ArgumentsBase 8 + from osprey.engine.udf.base import UDFBase 9 + from osprey.engine.udf.registry import UDFRegistry 11 10 12 11 13 12 class EmptyArguments(ArgumentsBase):
+3 -2
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_validate_dynamic_calls_have_annotated_rvalue.py
··· 1 1 import pytest 2 2 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 3 3 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 4 + from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 5 + ValidateDynamicCallsHaveAnnotatedRValue, 6 + ) 4 7 from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 5 - 6 - from ..validate_dynamic_calls_have_annotated_rvalue import ValidateDynamicCallsHaveAnnotatedRValue 7 8 8 9 pytestmark = [ 9 10 pytest.mark.use_validators([ValidateCallKwargs, ValidateDynamicCallsHaveAnnotatedRValue, UniqueStoredNames]),
+9 -6
osprey_worker/src/osprey/engine/ast_validator/validators/tests/test_validate_experiments.py
··· 1 1 from typing import cast 2 2 3 3 import pytest 4 - 5 - from ....conftest import ExecuteWithResultFunction 6 - from ....osprey_stdlib.udfs.experiments import CONTROL_BUCKET 7 - from ..unique_stored_names import UniqueStoredNames 8 - from ..validate_call_kwargs import ValidateCallKwargs 9 - from ..validate_experiments import ExperimentValidationResult, ValidateExperiments, ValidateExperimentsResult 4 + from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 + from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 + from osprey.engine.ast_validator.validators.validate_experiments import ( 7 + ExperimentValidationResult, 8 + ValidateExperiments, 9 + ValidateExperimentsResult, 10 + ) 11 + from osprey.engine.conftest import ExecuteWithResultFunction 12 + from osprey.engine.stdlib.udfs.experiments import CONTROL_BUCKET 10 13 11 14 pytestmark = [ 12 15 pytest.mark.use_validators(
+1 -2
osprey_worker/src/osprey/engine/config/tests/test_config.py
··· 10 10 from osprey.engine.ast_validator.validator_registry import ValidatorRegistry 11 11 from osprey.engine.config.config_registry import ConfigRegistry, ConfigSubkey 12 12 from osprey.engine.config.config_subkey_handler import ConfigSubkeyHandler 13 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 13 14 from pydantic.error_wrappers import ValidationError as PydanticValidationError 14 15 from pydantic.main import BaseModel 15 - 16 - from ...conftest import CheckFailureFunction, RunValidationFunction 17 16 18 17 19 18 class TestModel1(BaseModel):
+1 -2
osprey_worker/src/osprey/engine/executor/tests/test_binary_comparison.py
··· 1 1 import pytest 2 - 3 - from ...conftest import ExecuteFunction 2 + from osprey.engine.conftest import ExecuteFunction 4 3 5 4 6 5 @pytest.mark.parametrize(
+1 -2
osprey_worker/src/osprey/engine/executor/tests/test_binary_operation.py
··· 1 1 import pytest 2 - 3 - from ...conftest import ExecuteFunction 2 + from osprey.engine.conftest import ExecuteFunction 4 3 5 4 6 5 @pytest.mark.parametrize(
+1 -2
osprey_worker/src/osprey/engine/executor/tests/test_call.py
··· 1 1 from typing import Any 2 2 3 3 import pytest 4 + from osprey.engine.conftest import ExecuteFunction, ExecuteWithResultFunction 4 5 from osprey.engine.executor.execution_context import ExecutionContext 5 6 from osprey.engine.udf.arguments import ArgumentsBase 6 7 from osprey.engine.udf.base import InvalidDynamicReturnType, UDFBase 7 8 from osprey.engine.udf.registry import UDFRegistry 8 - 9 - from ...conftest import ExecuteFunction, ExecuteWithResultFunction 10 9 11 10 12 11 class Arguments(ArgumentsBase):
+2 -2
osprey_worker/src/osprey/engine/executor/tests/test_custom_extracted_features.py
··· 140 140 # we mismatch the type here (this should never happen but just in case) 141 141 context._effects[TestEffect] = effect_list 142 142 143 - with patch('osprey.engine.osprey_executor.execution_context.logger') as mock_logger: 143 + with patch('osprey.engine.executor.execution_context.logger') as mock_logger: 144 144 context.get_extracted_features() 145 145 146 146 mock_logger.error.assert_called_once() ··· 171 171 valid_effect = TestEffect(value='valid') 172 172 context._effects[TestEffect] = [valid_effect] 173 173 174 - with patch('osprey.engine.osprey_executor.execution_context.logger') as mock_logger: 174 + with patch('osprey.engine.executor.execution_context.logger') as mock_logger: 175 175 context.get_extracted_features() 176 176 177 177 assert context.add_custom_extracted_feature.call_count == 1
+2 -4
osprey_worker/src/osprey/engine/executor/tests/test_executor.py
··· 8 8 import gevent.pool 9 9 import pytest 10 10 from osprey.engine.ast_validator.validation_context import ValidationContext 11 - from osprey.engine.executor.execution_context import ExpectedUdfException 11 + from osprey.engine.conftest import ExecuteFunction, ExecuteWithResultFunction 12 + from osprey.engine.executor.execution_context import ExecutionContext, ExpectedUdfException 12 13 from osprey.engine.language_types.post_execution_convertible import PostExecutionConvertible 13 14 from osprey.engine.stdlib.udfs.import_ import Import 14 15 from osprey.engine.udf.arguments import ArgumentsBase 15 16 from osprey.engine.udf.base import BatchableUDFBase, UDFBase 16 17 from osprey.engine.udf.registry import UDFRegistry 17 18 from result import Err, Ok, Result 18 - 19 - from ...conftest import ExecuteFunction, ExecuteWithResultFunction 20 - from ..execution_context import ExecutionContext 21 19 22 20 23 21 class RecordingArguments(ArgumentsBase):
+1 -1
osprey_worker/src/osprey/engine/executor/tests/test_graph_data.py
··· 1 1 from datetime import datetime 2 2 3 - from ..graph_data import GraphData, Node, NodeType 3 + from osprey.engine.executor.graph_data import GraphData, Node, NodeType 4 4 5 5 6 6 def create_node(data: GraphData) -> Node:
+1 -2
osprey_worker/src/osprey/engine/executor/tests/test_literals.py
··· 1 1 from typing import Any 2 2 3 3 import pytest 4 - 5 - from ...conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 4 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 6 5 7 6 8 7 def test_num_literal(execute: ExecuteFunction) -> None:
+2 -3
osprey_worker/src/osprey/engine/executor/tests/test_render_graph.py
··· 11 11 ValidateDynamicCallsHaveAnnotatedRValue, 12 12 ) 13 13 from osprey.engine.conftest import RunValidationFunction 14 + from osprey.engine.executor.execution_graph import ExecutionGraph, compile_execution_graph 15 + from osprey.engine.executor.execution_visualizer import _render_graph 14 16 from osprey.engine.stdlib import get_config_registry 15 - 16 - from ..execution_graph import ExecutionGraph, compile_execution_graph 17 - from ..execution_visualizer import _render_graph 18 17 19 18 pytestmark = [ 20 19 pytest.mark.use_validators([ValidateCallKwargs, ValidateDynamicCallsHaveAnnotatedRValue, UniqueStoredNames]),
+1 -2
osprey_worker/src/osprey/engine/executor/tests/test_unary_operation.py
··· 1 1 import pytest 2 - 3 - from ...conftest import ExecuteFunction 2 + from osprey.engine.conftest import ExecuteFunction 4 3 5 4 6 5 @pytest.mark.parametrize(
+1 -2
osprey_worker/src/osprey/engine/language_types/tests/test_entities.py
··· 1 1 import pytest 2 - 3 - from ..entities import EntityT 2 + from osprey.engine.language_types.entities import EntityT 4 3 5 4 6 5 def test_allowed_types() -> None:
+1 -1
osprey_worker/src/osprey/engine/language_types/tests/test_osprey_invariant_generic.py
··· 1 1 from typing import Any, Mapping, Sequence, TypeVar 2 2 3 3 import pytest 4 - from osprey.engine.invariant_generic import OspreyInvariantGeneric 4 + from osprey.engine.language_types.osprey_invariant_generic import OspreyInvariantGeneric 5 5 6 6 7 7 @pytest.mark.parametrize(
+1 -2
osprey_worker/src/osprey/engine/query_language/tests/conftest.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validation_context import ValidatedSources 5 + from osprey.engine.conftest import RunValidationFunction 5 6 from typing_extensions import Protocol 6 - 7 - from ...conftest import RunValidationFunction 8 7 9 8 10 9 class MakeRulesSourcesFunction(Protocol):
+3 -4
osprey_worker/src/osprey/engine/query_language/tests/test_ast_druid_translator.py
··· 1 1 import json 2 2 3 3 import pytest 4 + from osprey.engine.conftest import CheckJsonOutputFunction, RunValidationFunction 4 5 from osprey.engine.query_language import parse_query_to_validated_ast 5 - 6 - from ...conftest import CheckJsonOutputFunction, RunValidationFunction 7 - from ..ast_druid_translator import DruidQueryTransformer 8 - from .conftest import MakeRulesSourcesFunction 6 + from osprey.engine.query_language.ast_druid_translator import DruidQueryTransformer 7 + from osprey.engine.query_language.tests.conftest import MakeRulesSourcesFunction 9 8 10 9 # The validators that the rules source validation should use, *not* the query source validation. 11 10 pytestmark = pytest.mark.use_standard_rules_validators()
+2 -3
osprey_worker/src/osprey/engine/query_language/tests/test_did_mutate_label.py
··· 4 4 import pytest 5 5 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 6 6 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 7 + from osprey.engine.conftest import RunValidationFunction 8 + from osprey.engine.query_language.udfs.did_mutate_label import DidAddLabel, DidRemoveLabel 7 9 from osprey.engine.stdlib import get_config_registry 8 10 from osprey.engine.udf.registry import UDFRegistry 9 - 10 - from ...conftest import RunValidationFunction 11 - from ..udfs.did_mutate_label import DidAddLabel, DidRemoveLabel 12 11 13 12 pytestmark: List[Callable[[Any], Any]] = [ 14 13 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames, get_config_registry().get_validator()]),
+2 -3
osprey_worker/src/osprey/engine/query_language/tests/test_parse_query_to_validated_ast.py
··· 1 1 from typing import Any, Callable, List 2 2 3 3 import pytest 4 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 4 5 from osprey.engine.query_language import parse_query_to_validated_ast 5 - 6 - from ...conftest import CheckFailureFunction, RunValidationFunction 7 - from .conftest import MakeRulesSourcesFunction 6 + from osprey.engine.query_language.tests.conftest import MakeRulesSourcesFunction 8 7 9 8 # The validators and UDFs that the rules source validation should use, *not* the query source validation. 10 9 pytestmark: List[Callable[[Any], Any]] = [
+2 -3
osprey_worker/src/osprey/engine/query_language/tests/test_regex_match.py
··· 6 6 from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 7 7 ValidateDynamicCallsHaveAnnotatedRValue, 8 8 ) 9 + from osprey.engine.conftest import CheckFailureFunction, RunValidationFunction 10 + from osprey.engine.query_language.udfs.regex_match import RegexMatch 9 11 from osprey.engine.udf.registry import UDFRegistry 10 - 11 - from ...conftest import CheckFailureFunction, RunValidationFunction 12 - from ..udfs.regex_match import RegexMatch 13 12 14 13 pytestmark: List[Callable[[Any], Any]] = [ 15 14 pytest.mark.use_validators([ValidateCallKwargs, ValidateDynamicCallsHaveAnnotatedRValue, UniqueStoredNames]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_domain_chopper.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..domain_chopper import DomainChopper 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.domain_chopper import DomainChopper 7 + from osprey.engine.udf.registry import UDFRegistry 9 8 10 9 pytestmark: List[Callable[[Any], Any]] = [ 11 10 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_domain_tld.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..domain_tld import DomainTld 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.domain_tld import DomainTld 7 + from osprey.engine.udf.registry import UDFRegistry 9 8 10 9 pytestmark: List[Callable[[Any], Any]] = [ 11 10 pytest.mark.use_validators([ValidateCallKwargs]),
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_email_domain.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..email_domain import EmailDomain, EmailSubdomain 9 - from ..json_data import JsonData 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.email_domain import EmailDomain, EmailSubdomain 7 + from osprey.engine.stdlib.udfs.json_data import JsonData 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_email_local_part.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..email_local_part import EmailLocalPart 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.email_local_part import EmailLocalPart 7 + from osprey.engine.udf.registry import UDFRegistry 9 8 10 9 pytestmark: List[Callable[[Any], Any]] = [ 11 10 pytest.mark.use_validators([ValidateCallKwargs]),
+10 -6
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_entity.py
··· 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, ExecuteWithResultFunction, RunValidationFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..email_domain import EmailDomain 10 - from ..entity import Entity, EntityJson 11 - from ..import_ import Import 6 + from osprey.engine.conftest import ( 7 + CheckFailureFunction, 8 + ExecuteFunction, 9 + ExecuteWithResultFunction, 10 + RunValidationFunction, 11 + ) 12 + from osprey.engine.stdlib.udfs.email_domain import EmailDomain 13 + from osprey.engine.stdlib.udfs.entity import Entity, EntityJson 14 + from osprey.engine.stdlib.udfs.import_ import Import 15 + from osprey.engine.udf.registry import UDFRegistry 12 16 13 17 pytestmark: List[Callable[[Any], Any]] = [ 14 18 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+60 -54
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_experiments.py
··· 4 4 import pytest 5 5 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 6 6 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 7 - from osprey.engine.executor.udf_execution_helpers import UDFHelpers 7 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 8 from osprey.engine.language_types.experiments import NOT_IN_EXPERIMENT_BUCKET, NOT_IN_EXPERIMENT_BUCKET_INDEX 9 - 10 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 11 - from ....osprey_udf.registry import UDFRegistry 12 - from ..entity import Entity 13 - from ..experiments import CONTROL_BUCKET, EXPERIMENT_GRANULARITY, Experiment, ExperimentsProvider, ExperimentWhen 14 - from ..rules import Rule 9 + from osprey.engine.stdlib.udfs.entity import Entity 10 + from osprey.engine.stdlib.udfs.experiments import ( 11 + CONTROL_BUCKET, 12 + EXPERIMENT_GRANULARITY, 13 + Experiment, 14 + # ExperimentsProvider, # TODO: figure out why this class no longer exists... 15 + ExperimentWhen, 16 + ) 17 + from osprey.engine.stdlib.udfs.rules import Rule 18 + from osprey.engine.udf.registry import UDFRegistry 15 19 16 20 pytestmark: List[Callable[[Any], Any]] = [ 17 21 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(Entity, Rule, Experiment, ExperimentWhen)), ··· 61 65 ] 62 66 63 67 64 - @mock.patch.object(ExperimentsProvider, 'get_bucket_assignment_request') 65 - def test_experiment_bucketing_nonlocal_with_missing_type( 66 - get_bucket_assignment_request_mock: mock.MagicMock, execute: ExecuteFunction 67 - ) -> None: 68 - get_bucket_assignment_request_mock.return_value = '0' 69 - experiment = f""" 70 - E1 = Entity(type='MyEntity', id='entity 1') 71 - A = Experiment( 72 - entity=E1, buckets=['{CONTROL_BUCKET}', 'treatment'], bucket_sizes=[50.0, 50.0], version=1, 73 - revision=1, local_bucketing=False 74 - ) 75 - """ 76 - data = execute(experiment, udf_helpers=UDFHelpers().set_udf_helper(Experiment, ExperimentsProvider())) 77 - assert data['A'] == [ 78 - 'A', 79 - 'entity 1', 80 - 'MyEntity', 81 - CONTROL_BUCKET, 82 - str(0), 83 - str(1), 84 - str(1), 85 - str(False), 86 - ] 68 + # TODO: related to ExperimentsProvider import issue above, re-enable when that is resolved 87 69 88 - 89 - @mock.patch.object(ExperimentsProvider, 'get_bucket_assignment_request') 90 - def test_experiment_bucketing_nonlocal_type_user( 91 - get_bucket_assignment_request_mock: mock.MagicMock, execute: ExecuteFunction 92 - ) -> None: 93 - get_bucket_assignment_request_mock.return_value = '0' 94 - experiment = f""" 95 - E1 = Entity(type='user', id='entity 1') 96 - A = Experiment( 97 - entity=E1, buckets=['{CONTROL_BUCKET}', 'treatment'], bucket_sizes=[50.0, 50.0], version=1, 98 - revision=1, local_bucketing=False 99 - ) 100 - """ 101 - data = execute(experiment, udf_helpers=UDFHelpers().set_udf_helper(Experiment, ExperimentsProvider())) 102 - assert data['A'] == [ 103 - 'A', 104 - 'entity 1', 105 - 'user', 106 - CONTROL_BUCKET, 107 - str(0), 108 - str(1), 109 - str(1), 110 - str(False), 111 - ] 70 + # @mock.patch.object(ExperimentsProvider, 'get_bucket_assignment_request') 71 + # def test_experiment_bucketing_nonlocal_with_missing_type( 72 + # get_bucket_assignment_request_mock: mock.MagicMock, execute: ExecuteFunction 73 + # ) -> None: 74 + # get_bucket_assignment_request_mock.return_value = '0' 75 + # experiment = f""" 76 + # E1 = Entity(type='MyEntity', id='entity 1') 77 + # A = Experiment( 78 + # entity=E1, buckets=['{CONTROL_BUCKET}', 'treatment'], bucket_sizes=[50.0, 50.0], version=1, 79 + # revision=1, local_bucketing=False 80 + # ) 81 + # """ 82 + # data = execute(experiment, udf_helpers=UDFHelpers().set_udf_helper(Experiment, ExperimentsProvider())) 83 + # assert data['A'] == [ 84 + # 'A', 85 + # 'entity 1', 86 + # 'MyEntity', 87 + # CONTROL_BUCKET, 88 + # str(0), 89 + # str(1), 90 + # str(1), 91 + # str(False), 92 + # ] 93 + # 94 + # 95 + # @mock.patch.object(ExperimentsProvider, 'get_bucket_assignment_request') 96 + # def test_experiment_bucketing_nonlocal_type_user( 97 + # get_bucket_assignment_request_mock: mock.MagicMock, execute: ExecuteFunction 98 + # ) -> None: 99 + # get_bucket_assignment_request_mock.return_value = '0' 100 + # experiment = f""" 101 + # E1 = Entity(type='user', id='entity 1') 102 + # A = Experiment( 103 + # entity=E1, buckets=['{CONTROL_BUCKET}', 'treatment'], bucket_sizes=[50.0, 50.0], version=1, 104 + # revision=1, local_bucketing=False 105 + # ) 106 + # """ 107 + # data = execute(experiment, udf_helpers=UDFHelpers().set_udf_helper(Experiment, ExperimentsProvider())) 108 + # assert data['A'] == [ 109 + # 'A', 110 + # 'entity 1', 111 + # 'user', 112 + # CONTROL_BUCKET, 113 + # str(0), 114 + # str(1), 115 + # str(1), 116 + # str(False), 117 + # ] 112 118 113 119 114 120 def test_consistent_bucketing_with_rollout(execute: ExecuteFunction) -> None:
+1 -2
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_external_service_utils.py
··· 2 2 3 3 import gevent 4 4 from gevent.event import Event 5 - 6 - from ....osprey_executor.external_service_utils import ExternalService, ExternalServiceAccessor 5 + from osprey.engine.executor.external_service_utils import ExternalService, ExternalServiceAccessor 7 6 8 7 9 8 class CountingService(ExternalService[str, int]):
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_extract_cookie.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..extract_cookie import ExtractCookie 9 - from ..json_data import JsonData 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.extract_cookie import ExtractCookie 7 + from osprey.engine.stdlib.udfs.json_data import JsonData 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_get_action_name.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..get_action_name import GetActionName 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.get_action_name import GetActionName 7 + from osprey.engine.udf.registry import UDFRegistry 9 8 10 9 pytestmark: List[Callable[[Any], Any]] = [ 11 10 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_import.py
··· 7 7 from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 8 8 ValidateDynamicCallsHaveAnnotatedRValue, 9 9 ) 10 - 11 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 12 - from ....osprey_udf.registry import UDFRegistry 13 - from ..import_ import Import 10 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 11 + from osprey.engine.stdlib.udfs.import_ import Import 12 + from osprey.engine.udf.registry import UDFRegistry 14 13 15 14 pytestmark: List[Callable[[Any], Any]] = [ 16 15 pytest.mark.use_validators(
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_ip_network.py
··· 3 3 4 4 import pytest 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import ExecuteFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..ip_network import IpNetwork 10 - from ..json_data import JsonData 6 + from osprey.engine.conftest import ExecuteFunction 7 + from osprey.engine.stdlib.udfs.ip_network import IpNetwork 8 + from osprey.engine.stdlib.udfs.json_data import JsonData 9 + from osprey.engine.udf.registry import UDFRegistry 11 10 12 11 pytestmark: List[Callable[[Any], Any]] = [ 13 12 pytest.mark.use_validators([ValidateCallKwargs]),
+8 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_json_data.py
··· 6 6 from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 7 7 ValidateDynamicCallsHaveAnnotatedRValue, 8 8 ) 9 - 10 - from ....conftest import CheckFailureFunction, ExecuteFunction, ExecuteWithResultFunction, RunValidationFunction 11 - from ....osprey_udf.registry import UDFRegistry 12 - from ..json_data import JsonData 9 + from osprey.engine.conftest import ( 10 + CheckFailureFunction, 11 + ExecuteFunction, 12 + ExecuteWithResultFunction, 13 + RunValidationFunction, 14 + ) 15 + from osprey.engine.stdlib.udfs.json_data import JsonData 16 + from osprey.engine.udf.registry import UDFRegistry 13 17 14 18 pytestmark: List[Callable[[Any], Any]] = [ 15 19 pytest.mark.use_validators([ValidateCallKwargs, ValidateDynamicCallsHaveAnnotatedRValue, UniqueStoredNames]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_list_length.py
··· 1 1 from typing import Any, List, Optional 2 2 3 3 import pytest 4 - 5 - from ....conftest import ExecuteFunction 6 - from ....osprey_udf.registry import UDFRegistry 7 - from ..list_length import ListLength 4 + from osprey.engine.conftest import ExecuteFunction 5 + from osprey.engine.stdlib.udfs.list_length import ListLength 6 + from osprey.engine.udf.registry import UDFRegistry 8 7 9 8 pytestmark = [pytest.mark.use_udf_registry(UDFRegistry.with_udfs(ListLength))] 10 9
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_list_read.py
··· 1 1 from typing import Any, List, Optional 2 2 3 3 import pytest 4 - 5 - from ....conftest import ExecuteFunction 6 - from ....osprey_udf.registry import UDFRegistry 7 - from ..list_read import ListRead 4 + from osprey.engine.conftest import ExecuteFunction 5 + from osprey.engine.stdlib.udfs.list_read import ListRead 6 + from osprey.engine.udf.registry import UDFRegistry 8 7 9 8 pytestmark = [pytest.mark.use_udf_registry(UDFRegistry.with_udfs(ListRead))] 10 9
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_list_sort.py
··· 1 1 from typing import Any, List, Optional 2 2 3 3 import pytest 4 - 5 - from ....conftest import ExecuteFunction 6 - from ....osprey_udf.registry import UDFRegistry 7 - from ..list_sort import ListSort 4 + from osprey.engine.conftest import ExecuteFunction 5 + from osprey.engine.stdlib.udfs.list_sort import ListSort 6 + from osprey.engine.udf.registry import UDFRegistry 8 7 9 8 pytestmark = [pytest.mark.use_udf_registry(UDFRegistry.with_udfs(ListSort))] 10 9
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_mx_lookup.py
··· 3 3 4 4 import pytest 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import ExecuteFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..mx_lookup import MXLookup 6 + from osprey.engine.conftest import ExecuteFunction 7 + from osprey.engine.stdlib.udfs.mx_lookup import MXLookup 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_phone_country.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 5 - 6 - from ....conftest import ExecuteFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..phone_country import PhoneCountry 5 + from osprey.engine.conftest import ExecuteFunction 6 + from osprey.engine.stdlib.udfs.phone_country import PhoneCountry 7 + from osprey.engine.udf.registry import UDFRegistry 9 8 10 9 pytestmark: List[Callable[[Any], Any]] = [ 11 10 pytest.mark.use_validators([ValidateCallKwargs]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_random_bool.py
··· 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..random_bool import RandomBool 6 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 7 + from osprey.engine.stdlib.udfs.random_bool import RandomBool 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_random_int.py
··· 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..random_int import RandomInt 6 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 7 + from osprey.engine.stdlib.udfs.random_int import RandomInt 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_regex_match.py
··· 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..regex_match import RegexMatch, RegexMatchMap 6 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 7 + from osprey.engine.stdlib.udfs.regex_match import RegexMatch, RegexMatchMap 8 + from osprey.engine.udf.registry import UDFRegistry 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_require.py
··· 6 6 from osprey.engine.ast_validator.validators.validate_dynamic_calls_have_annotated_rvalue import ( 7 7 ValidateDynamicCallsHaveAnnotatedRValue, 8 8 ) 9 - 10 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 11 - from ....osprey_udf.registry import UDFRegistry 12 - from ..json_data import JsonData 13 - from ..require import Require 9 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 10 + from osprey.engine.stdlib.udfs.json_data import JsonData 11 + from osprey.engine.stdlib.udfs.require import Require 12 + from osprey.engine.udf.registry import UDFRegistry 14 13 15 14 pytestmark: List[Callable[[Any], Any]] = [ 16 15 pytest.mark.use_validators([ValidateCallKwargs, ValidateDynamicCallsHaveAnnotatedRValue, UniqueStoredNames]),
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_resolve_optional.py
··· 9 9 ) 10 10 from osprey.engine.ast_validator.validators.validate_static_types import ValidateStaticTypes 11 11 from osprey.engine.ast_validator.validators.variables_must_be_defined import VariablesMustBeDefined 12 - 13 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 14 - from ....osprey_udf.registry import UDFRegistry 15 - from ..json_data import JsonData 16 - from ..resolve_optional import ResolveOptional 12 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 13 + from osprey.engine.stdlib.udfs.json_data import JsonData 14 + from osprey.engine.stdlib.udfs.resolve_optional import ResolveOptional 15 + from osprey.engine.udf.registry import UDFRegistry 17 16 18 17 pytestmark: List[Callable[[Any], Any]] = [ 19 18 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(JsonData, ResolveOptional)),
+2 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_rules.py
··· 18 18 ) 19 19 from osprey.engine.language_types.entities import EntityT 20 20 from osprey.engine.stdlib.udfs.entity import Entity 21 - from osprey.engine.stdlib.udfs.rules import Rule 21 + from osprey.engine.stdlib.udfs.labels import LabelAdd, LabelRemove 22 + from osprey.engine.stdlib.udfs.rules import Rule, WhenRules 22 23 from osprey.engine.stdlib.udfs.time_delta import TimeDelta 23 24 from osprey.engine.udf.arguments import ArgumentsBase 24 25 from osprey.engine.udf.base import UDFBase ··· 26 27 from osprey.engine.utils.proto_utils import datetime_to_timestamp 27 28 from osprey.rpc.labels.v1.service_pb2 import EntityMutation, LabelStatus 28 29 from osprey.worker.sinks.sink.output_sink import _get_label_effects_from_result 29 - 30 - from ..labels import LabelAdd, LabelRemove 31 - from ..rules import WhenRules 32 30 33 31 # Moved here because WhenRules is not included in the MVP yet 34 32
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_secret_data.py
··· 1 1 from typing import Any, Callable, Dict, List, Optional 2 2 3 3 import pytest 4 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 5 + from osprey.engine.stdlib.udfs.json_data import JsonData 6 + from osprey.engine.stdlib.udfs.string import StringClean, StringLength 7 + from osprey.engine.udf.registry import UDFRegistry 4 8 from typing_extensions import TypedDict 5 - 6 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 7 - from ....osprey_udf.registry import UDFRegistry 8 - from ..json_data import JsonData 9 - from ..string import StringClean, StringLength 10 9 11 10 pytestmark: List[Callable[[Any], Any]] = [ 12 11 pytest.mark.use_standard_rules_validators(),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_string_base64.py
··· 1 1 import pytest 2 - 3 - from ....conftest import ExecuteFunction 4 - from ....osprey_udf.registry import UDFRegistry 5 - from ..string_base64 import Base64Decode, Base64Encode 2 + from osprey.engine.conftest import ExecuteFunction 3 + from osprey.engine.stdlib.udfs.string_base64 import Base64Decode, Base64Encode 4 + from osprey.engine.udf.registry import UDFRegistry 6 5 7 6 pytestmark = [ 8 7 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(Base64Encode, Base64Decode)),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_string_hashes.py
··· 1 1 import pytest 2 - 3 - from ....conftest import ExecuteFunction 4 - from ....osprey_udf.registry import UDFRegistry 5 - from ..string_hashes import HashMd5, HashSha1, HashSha256, HashSha512 2 + from osprey.engine.conftest import ExecuteFunction 3 + from osprey.engine.stdlib.udfs.string_hashes import HashMd5, HashSha1, HashSha256, HashSha512 4 + from osprey.engine.udf.registry import UDFRegistry 6 5 7 6 pytestmark = [ 8 7 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(HashMd5, HashSha1, HashSha256, HashSha512)),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_strings.py
··· 3 3 from typing import Any, Callable, Dict, Iterable, List, Optional, Union, cast 4 4 5 5 import pytest 6 - 7 - from ....conftest import ExecuteFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..string import ( 6 + from osprey.engine.conftest import ExecuteFunction 7 + from osprey.engine.stdlib.udfs.string import ( 10 8 StringClean, 11 9 StringEndsWith, 12 10 StringExtractDomains, ··· 22 20 StringToLower, 23 21 StringToUpper, 24 22 ) 23 + from osprey.engine.udf.registry import UDFRegistry 25 24 26 25 pytestmark = [ 27 26 pytest.mark.use_udf_registry(
+4 -5
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_time_bucket.py
··· 3 3 import pytest 4 4 from osprey.engine.ast_validator.validators.unique_stored_names import UniqueStoredNames 5 5 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 6 - 7 - from ....conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 8 - from ....osprey_udf.registry import UDFRegistry 9 - from ..time_bucket import GetSnowflakeBucket, GetTimedeltaBucket, GetTimestampBucket 10 - from ..time_delta import TimeDelta 6 + from osprey.engine.conftest import CheckFailureFunction, ExecuteFunction, RunValidationFunction 7 + from osprey.engine.stdlib.udfs.time_bucket import GetSnowflakeBucket, GetTimedeltaBucket, GetTimestampBucket 8 + from osprey.engine.stdlib.udfs.time_delta import TimeDelta 9 + from osprey.engine.udf.registry import UDFRegistry 11 10 12 11 pytestmark: List[Callable[[Any], Any]] = [ 13 12 pytest.mark.use_validators([ValidateCallKwargs, UniqueStoredNames]),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_time_delta.py
··· 1 1 import pytest 2 - 3 - from ....conftest import ExecuteFunction 4 - from ....osprey_udf.registry import UDFRegistry 5 - from ..time_delta import TimeDelta 2 + from osprey.engine.conftest import ExecuteFunction 3 + from osprey.engine.stdlib.udfs.time_delta import TimeDelta 4 + from osprey.engine.udf.registry import UDFRegistry 6 5 7 6 pytestmark = [ 8 7 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(TimeDelta)),
+3 -4
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_time_since.py
··· 1 1 from datetime import datetime, timezone 2 2 3 3 import pytest 4 - 5 - from ....conftest import ExecuteFunction 6 - from ....osprey_udf.registry import UDFRegistry 7 - from ..time_since import TimeSince 4 + from osprey.engine.conftest import ExecuteFunction 5 + from osprey.engine.stdlib.udfs.time_since import TimeSince 6 + from osprey.engine.udf.registry import UDFRegistry 8 7 9 8 pytestmark = [ 10 9 pytest.mark.use_udf_registry(UDFRegistry.with_udfs(TimeSince)),
+1 -3
osprey_worker/src/osprey/engine/stdlib/udfs/tests/test_verdicts.py
··· 8 8 from osprey.engine.ast_validator.validators.validate_call_kwargs import ValidateCallKwargs 9 9 from osprey.engine.conftest import ExecuteWithResultFunction 10 10 from osprey.engine.stdlib import get_config_registry 11 - from osprey.engine.stdlib.udfs.rules import Rule 11 + from osprey.engine.stdlib.udfs.rules import Rule, WhenRules 12 12 from osprey.engine.stdlib.udfs.verdicts import DeclareVerdict 13 13 from osprey.engine.udf.registry import UDFRegistry 14 - 15 - from ..rules import WhenRules 16 14 17 15 # Moved here because WhenRules is not included in the MVP yet 18 16
+1 -1
osprey_worker/src/osprey/engine/udf/tests/test_arguments.py
··· 1 1 from typing import Optional, Union 2 2 3 - from ..arguments import ArgumentsBase, ConstExpr 3 + from osprey.engine.udf.arguments import ArgumentsBase, ConstExpr 4 4 5 5 StrConstExpr = ConstExpr[str] # This being inside the below function is causing mypy to crash 6 6
+1 -2
osprey_worker/src/osprey/engine/udf/tests/test_const_expr.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.ast import grammar 5 - 6 - from ..arguments import ConstExpr 5 + from osprey.engine.udf.arguments import ConstExpr 7 6 8 7 _T = TypeVar('_T') 9 8
+1 -2
osprey_worker/src/osprey/engine/udf/tests/test_rvalue_type_checker.py
··· 4 4 from osprey.engine.ast.grammar import Annotation, AnnotationWithVariants, Span 5 5 from osprey.engine.ast.sources import Sources 6 6 from osprey.engine.language_types.entities import EntityT 7 + from osprey.engine.udf.rvalue_type_checker import AnnotationConversionError, convert_ast_annotation_to_type_checker 7 8 from result import Err, Ok, Result 8 - 9 - from ..rvalue_type_checker import AnnotationConversionError, convert_ast_annotation_to_type_checker 10 9 11 10 12 11 @pytest.fixture(scope='module')
+3 -4
osprey_worker/src/osprey/engine/udf/tests/test_type_evaluator.py
··· 3 3 import pytest 4 4 from osprey.engine.language_types.entities import EntityT 5 5 from osprey.engine.language_types.osprey_invariant_generic import OspreyInvariantGeneric 6 - 7 - from ..arguments import ConstExpr 8 - from ..type_evaluator import is_compatible_type 9 - from ..type_helpers import to_display_str 6 + from osprey.engine.udf.arguments import ConstExpr 7 + from osprey.engine.udf.type_evaluator import is_compatible_type 8 + from osprey.engine.udf.type_helpers import to_display_str 10 9 11 10 12 11 class A:
+2 -3
osprey_worker/src/osprey/engine/udf/tests/test_type_helpers.py
··· 2 2 3 3 import pytest 4 4 from osprey.engine.language_types.entities import EntityT 5 - 6 - from ..arguments import ConstExpr 7 - from ..type_helpers import UnsupportedTypeError, get_typevar_substitution, to_display_str 5 + from osprey.engine.udf.arguments import ConstExpr 6 + from osprey.engine.udf.type_helpers import UnsupportedTypeError, get_typevar_substitution, to_display_str 8 7 9 8 10 9 @pytest.mark.parametrize(
+2 -5
osprey_worker/src/osprey/engine/udf/tests/test_udf.py
··· 2 2 from typing import Any 3 3 4 4 from osprey.engine.executor.execution_context import ExecutionContext 5 - from osprey.engine.udf.arguments import ArgumentsBase 6 - from osprey.engine.udf.base import UDFBase 7 - 8 - from ..arguments import ArgumentSpec, ConstExpr 9 - from ..base import MethodSpec 5 + from osprey.engine.udf.arguments import ArgumentsBase, ArgumentSpec, ConstExpr 6 + from osprey.engine.udf.base import MethodSpec, UDFBase 10 7 11 8 12 9 def test_udf_annotations_result() -> None:
+1 -2
osprey_worker/src/osprey/engine/udf/tests/test_udf_registry.py
··· 1 1 from typing import Any, Generic, List, Optional, Sequence, Tuple, Type, TypeVar, cast 2 2 3 3 import pytest 4 + from osprey.engine.conftest import CheckOutputFunction 4 5 from osprey.engine.executor.execution_context import ExecutionContext 5 6 from osprey.engine.language_types.osprey_invariant_generic import OspreyInvariantGeneric 6 7 from osprey.engine.udf.arguments import ArgumentsBase 7 8 from osprey.engine.udf.base import UDFBase 8 9 from osprey.engine.udf.registry import UDFRegistry 9 10 from osprey.engine.udf.type_helpers import UnsupportedTypeError 10 - 11 - from ...conftest import CheckOutputFunction 12 11 13 12 14 13 class Arguments(ArgumentsBase):
+1 -2
osprey_worker/src/osprey/engine/utils/tests/test_get_closest_string_within_threshold.py
··· 1 1 from typing import List, Optional 2 2 3 3 import pytest 4 - 5 - from ..get_closest_string_within_threshold import get_closest_string_within_threshold 4 + from osprey.engine.utils.get_closest_string_within_threshold import get_closest_string_within_threshold 6 5 7 6 8 7 @pytest.mark.parametrize(
+1 -2
osprey_worker/src/osprey/engine/utils/tests/test_graph.py
··· 1 1 import pytest 2 - 3 - from ..graph import CyclicDependencyError, Graph 2 + from osprey.engine.utils.graph import CyclicDependencyError, Graph 4 3 5 4 6 5 def test_graph_ops() -> None:
+1 -1
osprey_worker/src/osprey/engine/utils/tests/test_periodic_execution_yielder.py
··· 1 1 import time 2 2 3 - from ..periodic_execution_yielder import PeriodicExecutionYielder 3 + from osprey.engine.utils.periodic_execution_yielder import PeriodicExecutionYielder 4 4 5 5 6 6 # possibly need to mock out sleep calls if we run into unit test issues
+7 -3
osprey_worker/src/osprey/worker/lib/storage/tests/test_bulk_action_task.py
··· 3 3 4 4 import pytest 5 5 from osprey.worker.lib.snowflake import generate_snowflake 6 + from osprey.worker.lib.storage.bulk_action_task import ( 7 + BulkActionJob, 8 + BulkActionJobStatus, 9 + BulkActionTask, 10 + BulkActionTaskStatus, 11 + ) 12 + from osprey.worker.lib.storage.postgres import scoped_session 6 13 from sqlalchemy.orm import Session 7 - 8 - from ..bulk_action_task import BulkActionJob, BulkActionJobStatus, BulkActionTask, BulkActionTaskStatus 9 - from ..postgres import scoped_session 10 14 11 15 12 16 @pytest.fixture
+2 -3
osprey_worker/src/osprey/worker/lib/storage/tests/test_bulk_label_task.py
··· 6 6 import pytest 7 7 from osprey.rpc.labels.v1.service_pb2 import LabelStatus 8 8 from osprey.worker.lib.bulk_label import TaskStatus 9 + from osprey.worker.lib.storage.bulk_label_task import BASE_DELAY_SECONDS, BulkLabelTask 10 + from osprey.worker.lib.storage.postgres import scoped_session 9 11 from sqlalchemy.orm import Session 10 - 11 - from ..bulk_label_task import BASE_DELAY_SECONDS, BulkLabelTask 12 - from ..postgres import scoped_session 13 12 14 13 15 14 @pytest.fixture(autouse=True)
+3 -4
osprey_worker/src/osprey/worker/lib/storage/tests/test_entity_label_webhook.py
··· 4 4 5 5 import pytest 6 6 from osprey.worker.lib.osprey_shared.labels import LabelStatus 7 + from osprey.worker.lib.storage.entity_label_webhook import EntityLabelWebhook 8 + from osprey.worker.lib.storage.postgres import scoped_session 9 + from osprey.worker.lib.webhooks import WebhookStatus 7 10 from sqlalchemy import func 8 11 from sqlalchemy.orm.session import Session 9 - 10 - from ...webhooks import WebhookStatus 11 - from ..entity_label_webhook import EntityLabelWebhook 12 - from ..postgres import scoped_session 13 12 14 13 15 14 @pytest.fixture(autouse=True)
+2 -3
osprey_worker/src/osprey/worker/lib/storage/tests/test_queries.py
··· 7 7 from faker import Faker 8 8 from intervals.interval import DateTimeInterval 9 9 from osprey.worker.lib.snowflake import Snowflake 10 + from osprey.worker.lib.storage.postgres import scoped_session 11 + from osprey.worker.lib.storage.queries import Query, SavedQuery, SortOrder 10 12 from sqlalchemy.orm.session import Session 11 - 12 - from ..postgres import scoped_session 13 - from ..queries import Query, SavedQuery, SortOrder 14 13 15 14 fake = Faker() 16 15
+3 -3
osprey_worker/src/osprey/worker/sinks/sink/tests/test_bulk_label_sink.py
··· 16 16 DEFAULT_BULK_LABEL_COLLECTING_HEARTBEAT, 17 17 NO_LIMIT_BULK_LABEL_COLLECTING_HEARTBEAT, 18 18 NO_LIMIT_TOP_N_QUERY_TIME_DELTA_MAX, 19 + BulkLabelSink, 20 + UnretryableTaskException, 19 21 ) 22 + from osprey.worker.sinks.sink.input_stream import StaticInputStream 20 23 from osprey.worker.ui_api.osprey.lib.druid import TopNDruidQuery 21 24 from pytest_mock import MockFixture 22 - 23 - from ..bulk_label_sink import BulkLabelSink, UnretryableTaskException 24 - from ..input_stream import StaticInputStream 25 25 26 26 # Druid might also return null/empty values, we need to make sure we handle those in our sink. 27 27 _TASK_NULLISH_ENTITIES: List[Dict[str, Optional[str]]] = [{'UserId': None}, {'UserId': ''}]