Skip to content

Commit

Permalink
Update mock to use moto v5 (#328)
Browse files Browse the repository at this point in the history
* Update mock to use moto v5

* Another mock

* XRaySegment 😐
  • Loading branch information
ecomodeller authored Feb 20, 2024
1 parent cd8cde5 commit 84a8f1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions tests/drivers/test_sqlite_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _s3_db_factory(keys, datasets=None):
return _s3_db_factory


@moto.mock_s3
@moto.mock_aws
def test_remote_database(s3_db_factory):
keys = ("some", "keys")
dbpath = s3_db_factory(keys)
Expand All @@ -94,15 +94,15 @@ def test_invalid_url():
get_driver("foo", provider="sqlite-remote")


@moto.mock_s3
@moto.mock_aws
def test_nonexisting_url():
from terracotta import exceptions, get_driver

with pytest.raises(exceptions.InvalidDatabaseError):
get_driver("s3://foo/db.sqlite")


@moto.mock_s3
@moto.mock_aws
def test_remote_database_cache(s3_db_factory, raster_file, monkeypatch):
keys = ("some", "keys")
dbpath = s3_db_factory(keys)
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_remote_database_cache(s3_db_factory, raster_file, monkeypatch):
assert os.path.getmtime(driver.meta_store._local_path) != modification_date


@moto.mock_s3
@moto.mock_aws
def test_immutability(s3_db_factory, raster_file):
keys = ("some", "keys")
dbpath = s3_db_factory(keys, datasets={("some", "value"): str(raster_file)})
Expand All @@ -157,7 +157,7 @@ def test_immutability(s3_db_factory, raster_file):
driver.delete(("some", "value"))


@moto.mock_s3
@moto.mock_aws
def test_destructor(s3_db_factory, raster_file, capsys):
keys = ("some", "keys")
dbpath = s3_db_factory(keys, datasets={("some", "value"): str(raster_file)})
Expand Down
7 changes: 4 additions & 3 deletions tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import time

from moto import mock_xray_client, XRaySegment
from moto import mock_aws
from moto.xray import XRaySegment


def test_xray_tracing(caplog):
@mock_xray_client
@mock_aws
def run_test():
from terracotta import update_settings
import terracotta.profile
Expand Down Expand Up @@ -37,7 +38,7 @@ def func_to_trace():


def test_xray_exception(caplog):
@mock_xray_client
@mock_aws
def run_test():
from terracotta import update_settings
import terracotta.profile
Expand Down

0 comments on commit 84a8f1d

Please sign in to comment.