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

upgrage tests to python >3.8 #18

Merged
2 commits merged into from
Aug 7, 2024
Merged
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
8 changes: 7 additions & 1 deletion meteoblue_dataset_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ async def _fetch(
return

# meteoblue APIs return a JSON encoded error message
if response.status == 400 or response.status == 404 or response.status == 403 or response.status == 422 or response.status == 500:
if (
response.status == 400
or response.status == 404
or response.status == 403
or response.status == 422
or response.status == 500
):
json_response = await response.json()
# TODO: dataset api returns object with 'error_message'
# measurement api object with 'reason'
Expand Down
38 changes: 17 additions & 21 deletions meteoblue_dataset_sdk/protobuf/dataset_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 31 additions & 27 deletions meteoblue_dataset_sdk/protobuf/measurements_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@

import shutil
import tempfile
import unittest
import zlib
from pathlib import Path
from unittest import mock

from freezegun import freeze_time
from later.unittest import mock

# until we upgrade to >=3.8
from later.unittest.backport.async_case import IsolatedAsyncioTestCase


class TestFileCache(IsolatedAsyncioTestCase):
class TestFileCache(unittest.IsolatedAsyncioTestCase):
def setUp(self):
self.params = {
"units": {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_measurement_query.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from math import isnan
from meteoblue_dataset_sdk import ApiError, Client
from meteoblue_dataset_sdk.caching import FileCache
from meteoblue_dataset_sdk.protobuf.measurements_pb2 import MeasurementApiProtobuf
Expand All @@ -7,6 +6,7 @@
import logging
import os
import unittest
from math import isnan


class TestMeasurementQuery(unittest.TestCase):
Expand Down
Loading