python-influxdb/python-influxdb-new-pandas.patch
Markéta Machová bd6b87a9d1 Accepting request 1093753 from home:favogt:branches:devel:languages:python
This fixes building with pandas >= 2, but breaks with 1.5. Is that ok?

- Add patch to fix tests with newer pandas:
  * python-influxdb-new-pandas.patch

OBS-URL: https://build.opensuse.org/request/show/1093753
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-influxdb?expand=0&rev=34
2023-06-19 11:02:38 +00:00

89 lines
3.8 KiB
Diff

Index: influxdb-5.3.1/influxdb/tests/dataframe_client_test.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/dataframe_client_test.py
+++ influxdb-5.3.1/influxdb/tests/dataframe_client_test.py
@@ -19,7 +19,10 @@ from .client_test import _mocked_session
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
from influxdb import DataFrameClient
import numpy as np
@@ -947,7 +950,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1.index.tzinfo is None:
pd1.index = pd1.index.tz_localize('UTC')
pd2 = pd.DataFrame(
@@ -1008,7 +1011,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1.index.tzinfo is None:
pd1.index = pd1.index.tz_localize('UTC')
@@ -1019,7 +1022,7 @@ class TestDataFrameClient(unittest.TestC
index=pd.to_datetime([
"2015-01-29 21:55:43.702900257+0000",
"2015-01-29 21:55:43.702900257+0000",
- "2015-06-11 20:46:02+0000"]))
+ "2015-06-11 20:46:02+0000"], format='ISO8601'))
if pd1_dropna.index.tzinfo is None:
pd1_dropna.index = pd1_dropna.index.tz_localize('UTC')
Index: influxdb-5.3.1/influxdb/tests/influxdb08/dataframe_client_test.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/influxdb08/dataframe_client_test.py
+++ influxdb-5.3.1/influxdb/tests/influxdb08/dataframe_client_test.py
@@ -16,7 +16,10 @@ from .client_test import _mocked_session
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
from influxdb.influxdb08 import DataFrameClient
Index: influxdb-5.3.1/influxdb/tests/server_tests/client_test_with_server.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/tests/server_tests/client_test_with_server.py
+++ influxdb-5.3.1/influxdb/tests/server_tests/client_test_with_server.py
@@ -34,7 +34,10 @@ warnings.simplefilter('error', FutureWar
if not using_pypy:
import pandas as pd
- from pandas.util.testing import assert_frame_equal
+ try:
+ from pandas.testing import assert_frame_equal
+ except ImportError:
+ from pandas.util.testing import assert_frame_equal
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
Index: influxdb-5.3.1/influxdb/_dataframe_client.py
===================================================================
--- influxdb-5.3.1.orig/influxdb/_dataframe_client.py
+++ influxdb-5.3.1/influxdb/_dataframe_client.py
@@ -219,7 +219,7 @@ class DataFrameClient(InfluxDBClient):
else:
key = (name, tuple(sorted(tags.items())))
df = pd.DataFrame(data)
- df.time = pd.to_datetime(df.time)
+ df.time = pd.to_datetime(df.time, format='mixed')
if data_frame_index:
df.set_index(data_frame_index, inplace=True)