-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #7 implement parquet on S3 for track_metrics
- also unify approach with `upload_assets`
- Loading branch information
Showing
6 changed files
with
167 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,42 @@ | ||
import uuid | ||
|
||
import boto3 | ||
import moto.server | ||
import pytest | ||
|
||
pytest_plugins = [ | ||
"pytester", | ||
] | ||
|
||
pytest.register_assert_rewrite("apex_algorithm_qa_tools.scenarios") | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def moto_server() -> str: | ||
"""Fixture to run a mocked AWS server for testing.""" | ||
# Note: pass `port=0` to get a random free port. | ||
# TODO avoid the private `_server` attribute https://github.com/getmoto/moto/issues/7894 | ||
server = moto.server.ThreadedMotoServer(port=0) | ||
server.start() | ||
host, port = server._server.server_address | ||
yield f"http://{host}:{port}" | ||
server.stop() | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def aws_credentials(monkeypatch): | ||
monkeypatch.setenv("AWS_ACCESS_KEY_ID", "test123") | ||
monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "test456") | ||
|
||
|
||
@pytest.fixture | ||
def s3_client(moto_server): | ||
return boto3.client("s3", endpoint_url=moto_server) | ||
|
||
|
||
@pytest.fixture | ||
def s3_bucket(s3_client) -> str: | ||
# Unique bucket name for test isolation | ||
bucket = f"test-bucket-{uuid.uuid4().hex}" | ||
s3_client.create_bucket(Bucket=bucket) | ||
return bucket |
Oops, something went wrong.