Skip to content

Commit b277048

Browse files
authored
build(ingest): bump moto[s3] to 5.x and re-add datahub-documents to dev deps (#16691)
1 parent 2de8960 commit b277048

File tree

9 files changed

+52
-57
lines changed

9 files changed

+52
-57
lines changed

metadata-ingestion/constraints.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ more-itertools==10.8.0
859859
# jaraco-classes
860860
# jaraco-functools
861861
# simple-salesforce
862-
moto==4.2.14
862+
moto==5.1.22
863863
# via acryl-datahub
864864
msal==1.35.1
865865
# via
@@ -1124,7 +1124,7 @@ pure-sasl==0.6.2
11241124
# via
11251125
# acryl-pyhive
11261126
# thrift-sasl
1127-
py-partiql-parser==0.5.0
1127+
py-partiql-parser==0.6.3
11281128
# via moto
11291129
py4j==0.10.9.9
11301130
# via pyspark

metadata-ingestion/pyproject.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ delta-lake = [
444444
"deltalake>=0.6.3, != 0.6.4, != 0.18.0, <1.0.0; platform_system == 'Darwin' and platform_machine == 'arm64'",
445445
"deltalake>=0.6.3, != 0.6.4, <1.0.0; platform_system != 'Darwin' or platform_machine != 'arm64'",
446446
"more-itertools>=8.12.0,<11.0.0",
447-
"moto[s3]<5.0.0",
447+
"moto[s3]>=5.0.0,<6.0.0",
448448
"parse>=1.19.0,<2.0.0",
449449
"pyarrow>14.0.0,<24.0.0",
450450
"pydeequ>=1.1.0,<2.0.0",
@@ -603,7 +603,7 @@ gcs = [
603603
"botocore!=1.23.0,<2.0.0",
604604
"cachetools<6.0.0",
605605
"more-itertools>=8.12.0,<11.0.0",
606-
"moto[s3]<5.0.0",
606+
"moto[s3]>=5.0.0,<6.0.0",
607607
"parse>=1.19.0,<2.0.0",
608608
"pyarrow>14.0.0,<24.0.0",
609609
"pydeequ>=1.1.0,<2.0.0",
@@ -620,7 +620,7 @@ gcs-slim = [
620620
"botocore!=1.23.0,<2.0.0",
621621
"cachetools<6.0.0",
622622
"more-itertools>=8.12.0,<11.0.0",
623-
"moto[s3]<5.0.0",
623+
"moto[s3]>=5.0.0,<6.0.0",
624624
"parse>=1.19.0,<2.0.0",
625625
"pyarrow>14.0.0,<24.0.0",
626626
"smart-open[gcs,s3]>=5.2.1,<8.0.0",
@@ -1091,7 +1091,7 @@ s3 = [
10911091
"botocore!=1.23.0,<2.0.0",
10921092
"cachetools<6.0.0",
10931093
"more-itertools>=8.12.0,<11.0.0",
1094-
"moto[s3]<5.0.0",
1094+
"moto[s3]>=5.0.0,<6.0.0",
10951095
"parse>=1.19.0,<2.0.0",
10961096
"pyarrow>14.0.0,<24.0.0",
10971097
"pydeequ>=1.1.0,<2.0.0",
@@ -1108,7 +1108,7 @@ s3-slim = [
11081108
"botocore!=1.23.0,<2.0.0",
11091109
"cachetools<6.0.0",
11101110
"more-itertools>=8.12.0,<11.0.0",
1111-
"moto[s3]<5.0.0",
1111+
"moto[s3]>=5.0.0,<6.0.0",
11121112
"parse>=1.19.0,<2.0.0",
11131113
"pyarrow>14.0.0,<24.0.0",
11141114
"smart-open[s3]>=5.2.1,<8.0.0",
@@ -1473,7 +1473,7 @@ all = [
14731473
"looker-sdk>=23.0.0,<26.0.0",
14741474
"mlflow-skinny>=2.3.0,<2.21.0",
14751475
"more-itertools>=8.12.0,<11.0.0",
1476-
"moto[s3]<5.0.0",
1476+
"moto[s3]>=5.0.0,<6.0.0",
14771477
"msal>=1.31.1,<2.0.0",
14781478
"neo4j<7.0.0",
14791479
"nest-asyncio<2.0.0",
@@ -1627,7 +1627,7 @@ dev = [
16271627
"mixpanel>=4.9.0,<6.0.0",
16281628
"mlflow-skinny>=2.3.0,<2.21.0",
16291629
"more-itertools>=8.12.0,<11.0.0",
1630-
"moto[s3]<5.0.0",
1630+
"moto[s3]>=5.0.0,<6.0.0",
16311631
"msal>=1.31.1,<2.0.0",
16321632
"mypy==1.17.1",
16331633
"neo4j<7.0.0",
@@ -1820,7 +1820,7 @@ docs = [
18201820
"mixpanel>=4.9.0,<6.0.0",
18211821
"mlflow-skinny>=2.3.0,<2.21.0",
18221822
"more-itertools>=8.12.0,<11.0.0",
1823-
"moto[s3]<5.0.0",
1823+
"moto[s3]>=5.0.0,<6.0.0",
18241824
"msal>=1.31.1,<2.0.0",
18251825
"mypy==1.17.1",
18261826
"neo4j<7.0.0",
@@ -1977,7 +1977,7 @@ integration-tests = [
19771977
"jupyter_server>=2.14.1,<3.0.0",
19781978
"kerberos>=1.3.0,<2.0.0",
19791979
"more-itertools>=8.12.0,<11.0.0",
1980-
"moto[s3]<5.0.0",
1980+
"moto[s3]>=5.0.0,<6.0.0",
19811981
"numpy<2",
19821982
"openpyxl>=3.1.5,<4.0.0",
19831983
"pandas<3.0.0",

metadata-ingestion/setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@
389389
# ujson 5.2.0 has the JSONDecodeError exception type, which we need for error handling.
390390
"ujson>=5.2.0,<6.0.0",
391391
"smart-open[s3]>=5.2.1,<8.0.0",
392-
# moto 5.0.0 drops support for Python 3.7
393-
"moto[s3]<5.0.0",
392+
"moto[s3]>=5.0.0,<6.0.0",
394393
*path_spec_common,
395394
# cachetools is used by operation_config which is imported by profiling config
396395
*cachetools_lib,
@@ -884,9 +883,7 @@
884883
"clickhouse-usage",
885884
"cockroachdb",
886885
"confluence",
887-
# Note: datahub-documents removed from dev deps due to Python 3.10+ requirement
888-
# It's available as a separate extra and in the docs extra for doc generation
889-
# TODO: Re-add datahub-documents here now that Python 3.9 support was dropped
886+
"datahub-documents",
890887
"dataplex",
891888
"delta-lake",
892889
"dremio",

metadata-ingestion/tests/integration/dynamodb/test_dynamodb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import boto3
55
import pytest
66
from freezegun import freeze_time
7-
from moto import mock_dynamodb
7+
from moto import mock_aws
88
from mypy_boto3_dynamodb.type_defs import TagTypeDef
99

1010
from datahub.ingestion.glossary.classification_mixin import ClassificationConfig
@@ -23,7 +23,7 @@
2323

2424

2525
@freeze_time(FROZEN_TIME)
26-
@mock_dynamodb
26+
@mock_aws
2727
@pytest.mark.integration
2828
def test_dynamodb(pytestconfig, tmp_path):
2929
boto3.setup_default_session()

metadata-ingestion/tests/integration/excel/test_excel_s3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import moto
55
import pytest
66
from boto3.session import Session
7-
from moto import mock_s3
7+
from moto import mock_aws
88

99
from datahub.ingestion.run.pipeline import Pipeline
1010
from datahub.testing import mce_helpers
@@ -16,7 +16,7 @@
1616

1717
@pytest.fixture(scope="module")
1818
def s3_setup():
19-
with mock_s3():
19+
with mock_aws():
2020
session = Session(
2121
aws_access_key_id="test",
2222
aws_secret_access_key="test",

metadata-ingestion/tests/integration/s3/test_s3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import moto.s3
88
import pytest
99
from boto3.session import Session
10-
from moto import mock_s3
10+
from moto import mock_aws
1111
from pydantic import ValidationError
1212

1313
from datahub.ingestion.run.pipeline import Pipeline, PipelineContext
@@ -75,7 +75,7 @@ def bucket_names():
7575

7676
@pytest.fixture(scope="module", autouse=True)
7777
def s3():
78-
with mock_s3():
78+
with mock_aws():
7979
conn = Session(
8080
aws_access_key_id="test",
8181
aws_secret_access_key="test",
@@ -86,14 +86,14 @@ def s3():
8686

8787
@pytest.fixture(scope="module", autouse=True)
8888
def s3_resource(s3):
89-
with mock_s3():
89+
with mock_aws():
9090
conn = s3.resource("s3")
9191
yield conn
9292

9393

9494
@pytest.fixture(scope="module", autouse=True)
9595
def s3_client(s3):
96-
with mock_s3():
96+
with mock_aws():
9797
conn = s3.client("s3")
9898
yield conn
9999

metadata-ingestion/tests/unit/s3/test_s3_source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
from boto3.session import Session
88
from freezegun import freeze_time
9-
from moto import mock_s3
9+
from moto import mock_aws
1010

1111
from datahub.emitter.mcp import MetadataChangeProposalWrapper
1212
from datahub.ingestion.api.common import PipelineContext
@@ -26,7 +26,7 @@
2626

2727
@pytest.fixture(autouse=True)
2828
def s3():
29-
with mock_s3():
29+
with mock_aws():
3030
conn = Session(
3131
aws_access_key_id="test",
3232
aws_secret_access_key="test",

metadata-ingestion/tests/unit/test_aws_common.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import boto3
66
import pytest
7-
from moto import mock_iam, mock_lambda, mock_sts
7+
from moto import mock_aws
88

99
from datahub.ingestion.source.aws.aws_common import (
1010
AwsConnectionConfig,
@@ -143,9 +143,7 @@ def test_is_running_on_ec2_failure(self, mock_put, mock_get):
143143
mock_get.return_value.status_code = 404
144144
assert is_running_on_ec2() is False
145145

146-
@mock_sts
147-
@mock_lambda
148-
@mock_iam
146+
@mock_aws
149147
def test_get_current_identity_lambda(self):
150148
"""Test getting identity in Lambda environment"""
151149
with patch.dict(
@@ -186,7 +184,7 @@ def test_get_current_identity_lambda(self):
186184

187185
@patch("requests.get")
188186
@patch("requests.put")
189-
@mock_sts
187+
@mock_aws
190188
def test_get_instance_role_arn_success(self, mock_put, mock_get):
191189
"""Test getting EC2 instance role ARN"""
192190
mock_put.return_value.status_code = 200
@@ -206,15 +204,15 @@ def test_get_instance_role_arn_success(self, mock_put, mock_get):
206204
role_arn == "arn:aws:sts::123456789012:assumed-role/test-role/instance"
207205
)
208206

209-
@mock_sts
207+
@mock_aws
210208
def test_aws_connection_config_basic(self, mock_aws_config):
211209
"""Test basic AWS connection configuration"""
212210
session = mock_aws_config.get_session()
213211
creds = session.get_credentials()
214212
assert creds.access_key == "test-key"
215213
assert creds.secret_key == "test-secret"
216214

217-
@mock_sts
215+
@mock_aws
218216
def test_aws_connection_config_with_session_token(self):
219217
"""Test AWS connection with session token"""
220218
config = AwsConnectionConfig(
@@ -229,7 +227,7 @@ def test_aws_connection_config_with_session_token(self):
229227
assert creds is not None
230228
assert creds.token == "test-token"
231229

232-
@mock_sts
230+
@mock_aws
233231
def test_aws_connection_config_role_assumption(self):
234232
"""Test AWS connection with role assumption"""
235233
config = AwsConnectionConfig(
@@ -247,7 +245,7 @@ def test_aws_connection_config_role_assumption(self):
247245
creds = session.get_credentials()
248246
assert creds is not None
249247

250-
@mock_sts
248+
@mock_aws
251249
def test_aws_connection_config_skip_role_assumption(self):
252250
"""Test AWS connection skipping role assumption when already in role"""
253251
config = AwsConnectionConfig(
@@ -265,7 +263,7 @@ def test_aws_connection_config_skip_role_assumption(self):
265263
session = config.get_session()
266264
assert session is not None
267265

268-
@mock_sts
266+
@mock_aws
269267
def test_aws_connection_config_multiple_roles(self):
270268
"""Test AWS connection with multiple role assumption"""
271269
config = AwsConnectionConfig(
@@ -341,7 +339,7 @@ def test_environment_detection_parametrized(
341339
with patch.dict(os.environ, env_vars, clear=True):
342340
assert detect_aws_environment() == expected_environment
343341

344-
@mock_sts
342+
@mock_aws
345343
def test_role_assumption_credentials_cached_across_sessions(self):
346344
"""
347345
Test that assumed role credentials are cached and reused across multiple
@@ -413,7 +411,7 @@ def test_role_assumption_credentials_cached_across_sessions(self):
413411
# assume_role should still only be called once
414412
assert mock_assume_role.call_count == 1
415413

416-
@mock_sts
414+
@mock_aws
417415
def test_role_assumption_refreshes_expired_credentials(self):
418416
"""
419417
Test that expired credentials trigger a new role assumption.
@@ -471,7 +469,7 @@ def test_role_assumption_refreshes_expired_credentials(self):
471469
# assume_role should be called again due to expiration
472470
assert mock_assume_role.call_count == 2
473471

474-
@mock_sts
472+
@mock_aws
475473
def test_multiple_clients_use_same_cached_credentials(self):
476474
"""
477475
Test that multiple AWS clients (glue, s3, lakeformation) created from
@@ -521,7 +519,7 @@ def test_multiple_clients_use_same_cached_credentials(self):
521519
# assume_role should only be called once
522520
assert mock_assume_role.call_count == 1
523521

524-
@mock_sts
522+
@mock_aws
525523
def test_role_assumption_without_caching_before_fix(self):
526524
"""
527525
This test demonstrates the bug that existed before the fix.
@@ -576,7 +574,7 @@ def test_role_assumption_without_caching_before_fix(self):
576574
assert creds2.secret_key == "ASSUMED_SECRET"
577575
assert creds2.token == "ASSUMED_TOKEN"
578576

579-
@mock_sts
577+
@mock_aws
580578
def test_role_assumption_with_explicit_credentials(self):
581579
"""
582580
Test that explicit credentials (aws_access_key_id/aws_secret_access_key)
@@ -597,7 +595,7 @@ def test_role_assumption_with_explicit_credentials(self):
597595
assert creds.access_key == "EXPLICIT_KEY"
598596
assert creds.secret_key == "EXPLICIT_SECRET"
599597

600-
@mock_sts
598+
@mock_aws
601599
def test_role_assumption_chain(self):
602600
"""
603601
Test assuming multiple roles in a chain.

metadata-ingestion/uv.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)