From 1bbbc709aed21c78253d1d8666de761e7e34b120 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Wed, 21 Feb 2024 09:36:01 +0100 Subject: [PATCH 1/4] chore: add support for Python 3.12 --- .circleci/config.yml | 3 +++ setup.py | 1 + tests/test_InfluxDBClient.py | 5 +++-- tests/test_QueryApiDataFrame.py | 6 +++--- tests/test_Warnings.py | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e471dfbb..a47bde06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -202,6 +202,9 @@ workflows: - tests-python: name: test-3.11 python-image: "cimg/python:3.11" + - tests-python: + name: test-3.12 + python-image: "cimg/python:3.12" nightly: when: diff --git a/setup.py b/setup.py index e15b963e..ac1154d3 100644 --- a/setup.py +++ b/setup.py @@ -78,6 +78,7 @@ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Database', 'Topic :: Software Development :: Libraries', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tests/test_InfluxDBClient.py b/tests/test_InfluxDBClient.py index c2f9b0a5..7fdf834f 100644 --- a/tests/test_InfluxDBClient.py +++ b/tests/test_InfluxDBClient.py @@ -248,8 +248,9 @@ def _start_http_server(self): urllib3.disable_warnings() # Configure HTTP server self.httpd = http.server.HTTPServer(('localhost', 0), ServerWithSelfSingedSSL) - self.httpd.socket = ssl.wrap_socket(self.httpd.socket, certfile=f'{os.path.dirname(__file__)}/server.pem', - server_side=True) + context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + context.load_cert_chain(f'{os.path.dirname(__file__)}/server.pem') + self.httpd.socket = context.wrap_socket(self.httpd.socket, server_side=True) # Start server at background self.httpd_thread = threading.Thread(target=self.httpd.serve_forever) self.httpd_thread.start() diff --git a/tests/test_QueryApiDataFrame.py b/tests/test_QueryApiDataFrame.py index 670074bc..31396be6 100644 --- a/tests/test_QueryApiDataFrame.py +++ b/tests/test_QueryApiDataFrame.py @@ -268,7 +268,7 @@ def test_query_with_warning(self): '|> range(start: -5s, stop: now()) ' '|> filter(fn: (r) => r._measurement == "mem") ' "my-org") - self.assertEqual(1, len(warnings)) + self.assertEqual(1, len([w for w in warnings if w.category == MissingPivotFunction])) def test_query_without_warning(self): httpretty.register_uri(httpretty.POST, uri="http://localhost/api/v2/query", status=200, body='\n') @@ -284,7 +284,7 @@ def test_query_without_warning(self): '|> filter(fn: (r) => r._measurement == "mem") ' '|> schema.fieldsAsCols() ' "my-org") - self.assertEqual(0, len(warns)) + self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction])) with warnings.catch_warnings(record=True) as warns: self.client.query_api().query_data_frame( @@ -293,7 +293,7 @@ def test_query_without_warning(self): '|> filter(fn: (r) => r._measurement == "mem") ' '|> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: "_value")' "my-org") - self.assertEqual(0, len(warns)) + self.assertEqual(0, len([w for w in warns if w.category == MissingPivotFunction])) def test_pivoted_data(self): query_response = \ diff --git a/tests/test_Warnings.py b/tests/test_Warnings.py index 9d32d368..f3bc3f20 100644 --- a/tests/test_Warnings.py +++ b/tests/test_Warnings.py @@ -27,4 +27,5 @@ def test_cloud_only_warning(self): with InfluxDBClient(url="http://localhost", token="my-token", org="my-org") as client: service = BucketSchemasService(api_client=client.api_client) service.get_measurement_schemas(bucket_id="01010101") + warnings = [w for w in warnings if w.category == CloudOnlyWarning] self.assertEqual(1, len(warnings)) From 243a33ea4744a353f08c537fb9cffc16f880fa5f Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Wed, 21 Feb 2024 09:46:38 +0100 Subject: [PATCH 2/4] fix: ci build --- scripts/ci-test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/ci-test.sh b/scripts/ci-test.sh index 8e2cdd4e..dc7c9b59 100755 --- a/scripts/ci-test.sh +++ b/scripts/ci-test.sh @@ -8,13 +8,13 @@ ENABLED_CISO_8601="${ENABLED_CISO_8601:-true}" # Install requirements # python --version -pip install -e . --user -pip install -e .\[extra\] --user -pip install -e .\[test\] --user -pip install -e .\[async\] --user +pip install . --user +pip install .\[extra\] --user +pip install .\[test\] --user +pip install .\[async\] --user if [ "$ENABLED_CISO_8601" = true ] ; then echo "ciso8601 is enabled" - pip install -e .\[ciso\] --user + pip install .\[ciso\] --user else echo "ciso8601 is disabled" fi From dabfb07fca61ef16fb0b07bef29b6f36edd2ff0e Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Wed, 21 Feb 2024 09:50:22 +0100 Subject: [PATCH 3/4] docs: update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e542413a..284f8062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## 1.41.0 [unreleased] +### Features +1. [#643](https://github.com/influxdata/influxdb-client-python/pull/643): Add a support for Python 3.12 + ### Bug Fixes 1. [#636](https://github.com/influxdata/influxdb-client-python/pull/636): Handle missing data in data frames 2. [#638](https://github.com/influxdata/influxdb-client-python/pull/638), [#642](https://github.com/influxdata/influxdb-client-python/pull/642): Refactor DataFrame operations to avoid chained assignment and resolve FutureWarning in pandas, ensuring compatibility with pandas 3.0. From 2ddeb0f48b868b21d0e634ed764f3c3ea5bf35fe Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Wed, 21 Feb 2024 09:57:19 +0100 Subject: [PATCH 4/4] chore: add support for Python 3.12 --- tests/test_WriteApiDataFrame.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_WriteApiDataFrame.py b/tests/test_WriteApiDataFrame.py index 3675519a..6ea7a98b 100644 --- a/tests/test_WriteApiDataFrame.py +++ b/tests/test_WriteApiDataFrame.py @@ -313,7 +313,7 @@ def test_with_period_index(self): data_frame = pd.DataFrame(data={ 'value': [1, 2], }, - index=pd.period_range(start='2020-04-05 01:00', freq='H', periods=2)) + index=pd.period_range(start='2020-04-05 01:00', freq='h', periods=2)) points = data_frame_to_list_of_points(data_frame=data_frame, point_settings=PointSettings(), @@ -498,7 +498,7 @@ def test_specify_timezone_period_time_index(self): data_frame = pd.DataFrame(data={ 'value1': [10, 20], 'value2': [30, 40], - }, index=pd.period_range(start='2020-05-24 10:00', freq='H', periods=2)) + }, index=pd.period_range(start='2020-05-24 10:00', freq='h', periods=2)) print(data_frame.to_string()) @@ -519,7 +519,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self): '2value': [30.0, np.nan, np.nan, np.nan, np.nan], '3value': [30.0, 30.0, 30.0, np.nan, np.nan], 'avalue': [30.0, 30.0, 30.0, 30.0, 30.0] - }, index=pd.period_range('2020-05-24 10:00', freq='H', periods=5)) + }, index=pd.period_range('2020-05-24 10:00', freq='h', periods=5)) points = data_frame_to_list_of_points(data_frame, PointSettings(), @@ -536,7 +536,7 @@ def test_serialization_for_nan_in_columns_starting_with_digits(self): '1value': [np.nan], 'avalue': [30.0], 'bvalue': [30.0] - }, index=pd.period_range('2020-05-24 10:00', freq='H', periods=1)) + }, index=pd.period_range('2020-05-24 10:00', freq='h', periods=1)) points = data_frame_to_list_of_points(data_frame, PointSettings(), pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy