diff --git a/tests/unit/sagemaker/feature_store/feature_processor/test_data_helpers.py b/tests/unit/sagemaker/feature_store/feature_processor/test_data_helpers.py index 9c4f0fef49..bd572c7694 100644 --- a/tests/unit/sagemaker/feature_store/feature_processor/test_data_helpers.py +++ b/tests/unit/sagemaker/feature_store/feature_processor/test_data_helpers.py @@ -52,6 +52,20 @@ "some-other-key": {"some-key": "some-value"}, } +DATA_SOURCE_UNIQUE_ID_TOO_LONG = """ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\ +""" + DESCRIBE_FEATURE_GROUP_RESPONSE = { "FeatureGroupArn": INPUT_FEATURE_GROUP_ARN, "FeatureGroupName": INPUT_FEATURE_GROUP_NAME, diff --git a/tests/unit/sagemaker/feature_store/feature_processor/test_validation.py b/tests/unit/sagemaker/feature_store/feature_processor/test_validation.py index 8e0115afd2..b0fde3274b 100644 --- a/tests/unit/sagemaker/feature_store/feature_processor/test_validation.py +++ b/tests/unit/sagemaker/feature_store/feature_processor/test_validation.py @@ -19,8 +19,6 @@ import pytest import test_data_helpers as tdh -import string -import random from mock import Mock from sagemaker.feature_store.feature_processor._validation import ( @@ -164,7 +162,7 @@ def invalid_spark_position(spark, fg_data_source, s3_data_source): ("", "unique_id", "data_source_name of input does not match pattern '.*'."), ( "source", - "".join(random.choices(string.ascii_uppercase, k=2050)), + tdh.DATA_SOURCE_UNIQUE_ID_TOO_LONG, "data_source_unique_id of input does not match pattern '.*'.", ), ("source", "", "data_source_unique_id of input does not match pattern '.*'."), diff --git a/tests/unit/sagemaker/remote_function/core/test_stored_function.py b/tests/unit/sagemaker/remote_function/core/test_stored_function.py index b263682641..68a05c08a6 100644 --- a/tests/unit/sagemaker/remote_function/core/test_stored_function.py +++ b/tests/unit/sagemaker/remote_function/core/test_stored_function.py @@ -39,7 +39,6 @@ from sagemaker.workflow.function_step import _FunctionStep, DelayedReturn from sagemaker.workflow.parameters import ParameterFloat -from sagemaker.utils import sagemaker_timestamp from tests.unit.sagemaker.experiments.helpers import ( TEST_EXP_DISPLAY_NAME, @@ -55,7 +54,7 @@ FUNCTION_FOLDER = "function" ARGUMENT_FOLDER = "arguments" RESULT_FOLDER = "results" -PIPELINE_BUILD_TIME = sagemaker_timestamp() +PIPELINE_BUILD_TIME = "2022-05-10T17:30:20Z" mock_s3 = {} diff --git a/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py index 96f6998af6..2b59113354 100644 --- a/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py @@ -202,7 +202,7 @@ def test_unsupported_cpu_instance( ).fit() -@pytest.mark.parametrize("unsupported_gpu_instance_class", UNSUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("unsupported_gpu_instance_class", sorted(UNSUPPORTED_GPU_INSTANCE_CLASSES)) def test_unsupported_gpu_instance( unsupported_gpu_instance_class, huggingface_training_compiler_version, @@ -366,7 +366,7 @@ def test_unsupported_distribution( @patch("sagemaker.utils.create_tar_file", MagicMock()) @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) -@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_pytorchxla_distribution( time, name_from_base, @@ -430,7 +430,7 @@ def test_pytorchxla_distribution( @patch("sagemaker.utils.create_tar_file", MagicMock()) @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) -@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_default_compiler_config( time, name_from_base, diff --git a/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py b/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py index a650379dfd..dfe4d10c3a 100644 --- a/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py @@ -201,7 +201,7 @@ def test_unsupported_cpu_instance( ).fit() -@pytest.mark.parametrize("unsupported_gpu_instance_class", UNSUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("unsupported_gpu_instance_class", sorted(UNSUPPORTED_GPU_INSTANCE_CLASSES)) def test_unsupported_gpu_instance( unsupported_gpu_instance_class, huggingface_training_compiler_version, @@ -315,7 +315,7 @@ def test_unsupported_distribution( @patch("sagemaker.utils.create_tar_file", MagicMock()) @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) -@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_default_compiler_config( time, name_from_base, diff --git a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py index 9a7ba698f3..7417e006a1 100644 --- a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py @@ -191,7 +191,7 @@ def test_unsupported_cpu_instance(cpu_instance_type, pytorch_training_compiler_v ).fit() -@pytest.mark.parametrize("unsupported_gpu_instance_class", UNSUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("unsupported_gpu_instance_class", sorted(UNSUPPORTED_GPU_INSTANCE_CLASSES)) def test_unsupported_gpu_instance( unsupported_gpu_instance_class, pytorch_training_compiler_version ): @@ -309,7 +309,7 @@ def test_unsupported_distribution( @patch("sagemaker.utils.create_tar_file", MagicMock()) @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) -@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_pytorchxla_distribution( time, name_from_base, @@ -372,7 +372,7 @@ def test_pytorchxla_distribution( @patch("sagemaker.utils.create_tar_file", MagicMock()) @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) -@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +@pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_default_compiler_config( time, name_from_base, diff --git a/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py b/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py index 67530bc288..ebad1366ee 100644 --- a/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py @@ -176,7 +176,9 @@ def test_cpu_instance( compiler_config=TrainingCompilerConfig(), ).fit() - @pytest.mark.parametrize("unsupported_gpu_instance_class", UNSUPPORTED_GPU_INSTANCE_CLASSES) + @pytest.mark.parametrize( + "unsupported_gpu_instance_class", sorted(UNSUPPORTED_GPU_INSTANCE_CLASSES) + ) def test_gpu_instance( self, unsupported_gpu_instance_class, @@ -254,7 +256,7 @@ def test_python_2(self, tensorflow_training_version): @patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) @patch("time.time", return_value=TIME) class TestTrainingCompilerConfig: - @pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) + @pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_default( self, time, @@ -308,7 +310,7 @@ def test_default( actual_train_args == expected_train_args ), f"{json.dumps(actual_train_args, indent=2)} != {json.dumps(expected_train_args, indent=2)}" - @pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) + @pytest.mark.parametrize("instance_class", sorted(SUPPORTED_GPU_INSTANCE_CLASSES)) def test_byoc( self, time, diff --git a/tests/unit/sagemaker/workflow/test_training_step.py b/tests/unit/sagemaker/workflow/test_training_step.py index 673e54dbbe..f31eb07d85 100644 --- a/tests/unit/sagemaker/workflow/test_training_step.py +++ b/tests/unit/sagemaker/workflow/test_training_step.py @@ -263,6 +263,8 @@ Join(on="/", values=["s3://my-bucket", "my-input"]), ] +OUTPUT_PARAM_LIST = ["s3://my-bucket/my-output-path", ParameterString(name="OutputPath")] + @pytest.fixture def training_input(): @@ -454,6 +456,7 @@ def test_training_step_estimator_with_param_code_input( assert step_def == step_def2 +@pytest.mark.skip(reason="incompatible with pytest-xdist") @pytest.mark.parametrize("estimator", ESTIMATOR_LISTS) @pytest.mark.parametrize("training_input", INPUT_PARAM_LISTS) @pytest.mark.parametrize( @@ -523,6 +526,7 @@ def test_training_step_with_framework_estimator( assert step_def == step_def2 +@pytest.mark.skip(reason="incompatible with pytest-xdist") @patch("sagemaker.workflow.utilities._pipeline_config", MOCKED_PIPELINE_CONFIG) @pytest.mark.parametrize("estimator", ESTIMATOR_LISTS_LOCAL_CODE) @pytest.mark.parametrize("training_input", INPUT_PARAM_LISTS)