Skip to content

Commit

Permalink
Fix s3 tests (moto.mock_s3 -> moto.aws)
Browse files Browse the repository at this point in the history
  • Loading branch information
thequilo committed Aug 23, 2024
1 parent 9acd061 commit e3dbea0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_observers/test_s3_observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _get_file_data(bucket_name, key):
return s3.Object(bucket_name, key).get()["Body"].read()


@moto.mock_s3
@moto.aws
def test_fs_observer_started_event_creates_bucket(observer, sample_run):
_id = observer.started_event(**sample_run)
run_dir = s3_join(BASEDIR, str(_id))
Expand All @@ -102,7 +102,7 @@ def test_fs_observer_started_event_creates_bucket(observer, sample_run):
}


@moto.mock_s3
@moto.aws
def test_fs_observer_started_event_increments_run_id(observer, sample_run):
_id = observer.started_event(**sample_run)
_id2 = observer.started_event(**sample_run)
Expand All @@ -119,15 +119,15 @@ def test_s3_observer_equality():
assert obs_one != different_bucket


@moto.mock_s3
@moto.aws
def test_raises_error_on_duplicate_id_directory(observer, sample_run):
observer.started_event(**sample_run)
sample_run["_id"] = 1
with pytest.raises(FileExistsError):
observer.started_event(**sample_run)


@moto.mock_s3
@moto.aws
def test_completed_event_updates_run_json(observer, sample_run):
observer.started_event(**sample_run)
run = json.loads(
Expand All @@ -145,7 +145,7 @@ def test_completed_event_updates_run_json(observer, sample_run):
assert run["status"] == "COMPLETED"


@moto.mock_s3
@moto.aws
def test_interrupted_event_updates_run_json(observer, sample_run):
observer.started_event(**sample_run)
run = json.loads(
Expand All @@ -163,7 +163,7 @@ def test_interrupted_event_updates_run_json(observer, sample_run):
assert run["status"] == "SERVER_EXPLODED"


@moto.mock_s3
@moto.aws
def test_failed_event_updates_run_json(observer, sample_run):
observer.started_event(**sample_run)
run = json.loads(
Expand All @@ -181,7 +181,7 @@ def test_failed_event_updates_run_json(observer, sample_run):
assert run["status"] == "FAILED"


@moto.mock_s3
@moto.aws
def test_queued_event_updates_run_json(observer, sample_run):
del sample_run["start_time"]
sample_run["queue_time"] = T2
Expand All @@ -194,7 +194,7 @@ def test_queued_event_updates_run_json(observer, sample_run):
assert run["status"] == "QUEUED"


@moto.mock_s3
@moto.aws
def test_artifact_event_works(observer, sample_run, tmpfile):
observer.started_event(**sample_run)
observer.artifact_event("test_artifact.py", tmpfile.name)
Expand Down

0 comments on commit e3dbea0

Please sign in to comment.