Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test python 3.12 fix #265

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion descarteslabs/core/catalog/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def test_ndarray_geocontext(self, mock_raster):
image = Image.get("landsat:LC08:PRE:TOAR:meta_LC80270312016188_v1")
arr, info = image.ndarray("red", resolution=1000, raster_info=True)

assert mock_raster.called_once()
mock_raster.assert_called_once()
assert image.geocontext.geometry is not None
print(mock_raster.call_args)
assert mock_raster.call_args[1]["cutline"] is None
Expand Down
8 changes: 8 additions & 0 deletions descarteslabs/core/catalog/tests/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,13 @@ def test_warnings(self):
)

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", category=DeprecationWarning)
warnings.simplefilter("always")
Product.get("product_id", client=self.client)

print(f"w={w}")
for ww in w:
print(f"{ww.category} {ww.message}")
assert w[0].category is FutureWarning
assert str(w[0].message) == "This is a test of a FutureWarning"
assert w[1].category is UserWarning
Expand Down Expand Up @@ -643,11 +647,15 @@ def test_bad_warnings(self):
)

with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("ignore", category=DeprecationWarning)
warnings.simplefilter("always")
p = Product.get("product_id", client=self.client)
assert isinstance(p, Product)
assert p.id == "product_id"

print(f"w={w}")
for ww in w:
print(f"{ww.category} {ww.message}")
assert len(w) == 0

@responses.activate
Expand Down
5 changes: 5 additions & 0 deletions descarteslabs/core/compute/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,8 @@ def assert_url_called(self, uri, times=1, json=None, body=None, params=None):
msg += "\n\nParams:\n" + "\n".join(calls_with_params)

assert count == times, msg

# this was removed from python 3.12 unittest.TestCase
def assertDictContainsSubset(self, subset, dictionary):
for key, value in subset.items():
assert key in dictionary and dictionary[key] == value
Loading