- Update to 5.3.2:
* Correctly serialize nanosecond dataframe timestamps (#926) - Refresh all patches and skip broken test with numpy >= 2 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-influxdb?expand=0&rev=43
This commit is contained in:
commit
0349ba2db0
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
3
influxdb-5.3.1.tar.gz
Normal file
3
influxdb-5.3.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:46f85e7b04ee4b3dee894672be6a295c94709003a7ddea8820deec2ac4d8b27a
|
||||
size 67385
|
3
influxdb-5.3.2.tar.gz
Normal file
3
influxdb-5.3.2.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:58c647f6043712dd86e9aee12eb4ccfbbb5415467bc9910a48aa8c74c1108970
|
||||
size 70792
|
35
influxdb-pr845-pandas-future.patch
Normal file
35
influxdb-pr845-pandas-future.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From db0714de2350493a1776ca4d4d9b743695d68576 Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Head <chead@chead.ca>
|
||||
Date: Sat, 22 Aug 2020 11:15:33 -0700
|
||||
Subject: [PATCH] Fix FutureWarning from pandas
|
||||
|
||||
---
|
||||
influxdb/_dataframe_client.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: influxdb-5.3.2/influxdb/_dataframe_client.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/_dataframe_client.py
|
||||
+++ influxdb-5.3.2/influxdb/_dataframe_client.py
|
||||
@@ -305,7 +305,7 @@ class DataFrameClient(InfluxDBClient):
|
||||
'time': np.int64(ts.value / precision_factor)}
|
||||
for ts, tag, (_, rec) in zip(
|
||||
dataframe.index,
|
||||
- dataframe[tag_columns].to_dict('record'),
|
||||
+ dataframe[tag_columns].to_dict('records'),
|
||||
dataframe[field_columns].iterrows()
|
||||
)
|
||||
]
|
||||
Index: influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/dataframe_client_test.py
|
||||
+++ influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
|
||||
@@ -334,7 +334,7 @@ class TestDataFrameClient(unittest.TestC
|
||||
['some', "2", 2, None], # skip None
|
||||
['', "2", 2, None], # all tags empty
|
||||
],
|
||||
- index=pd.period_range(now, freq='H', periods=5),
|
||||
+ index=pd.period_range(now, freq='h', periods=5),
|
||||
columns=["tag_one", "column_one", "column_two", "tag_three"]
|
||||
)
|
||||
|
106
python-influxdb-new-pandas.patch
Normal file
106
python-influxdb-new-pandas.patch
Normal file
@ -0,0 +1,106 @@
|
||||
Index: influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/dataframe_client_test.py
|
||||
+++ influxdb-5.3.2/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.2/influxdb/tests/influxdb08/dataframe_client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/influxdb08/dataframe_client_test.py
|
||||
+++ influxdb-5.3.2/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.2/influxdb/tests/server_tests/client_test_with_server.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/server_tests/client_test_with_server.py
|
||||
+++ influxdb-5.3.2/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.2/influxdb/_dataframe_client.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/_dataframe_client.py
|
||||
+++ influxdb-5.3.2/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)
|
||||
@@ -449,7 +449,7 @@ class DataFrameClient(InfluxDBClient):
|
||||
include=['floating']).columns)
|
||||
nonfloat_columns = dframe.columns[~dframe.columns.isin(
|
||||
float_columns)]
|
||||
- dframe[float_columns] = dframe[float_columns].applymap(repr)
|
||||
+ dframe[float_columns] = dframe[float_columns].map(repr)
|
||||
dframe[nonfloat_columns] = (dframe[nonfloat_columns].astype(str))
|
||||
elif isinstance(numeric_precision, int):
|
||||
# If precision is specified, round to appropriate precision
|
||||
@@ -462,7 +462,7 @@ class DataFrameClient(InfluxDBClient):
|
||||
|
||||
# If desired precision is > 10 decimal places, need to use repr
|
||||
if numeric_precision > 10:
|
||||
- dframe[float_columns] = (dframe[float_columns].applymap(repr))
|
||||
+ dframe[float_columns] = (dframe[float_columns].map(repr))
|
||||
dframe[nonfloat_columns] = (dframe[nonfloat_columns]
|
||||
.astype(str))
|
||||
else:
|
153
python-influxdb-no-six.patch
Normal file
153
python-influxdb-no-six.patch
Normal file
@ -0,0 +1,153 @@
|
||||
Index: influxdb-5.3.2/influxdb.egg-info/requires.txt
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb.egg-info/requires.txt
|
||||
+++ influxdb-5.3.2/influxdb.egg-info/requires.txt
|
||||
@@ -1,7 +1,6 @@
|
||||
python-dateutil>=2.6.0
|
||||
pytz
|
||||
requests>=2.17.0
|
||||
-six>=1.10.0
|
||||
msgpack
|
||||
|
||||
[test]
|
||||
Index: influxdb-5.3.2/influxdb/client.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/client.py
|
||||
+++ influxdb-5.3.2/influxdb/client.py
|
||||
@@ -21,7 +21,7 @@ import msgpack
|
||||
import requests
|
||||
import requests.exceptions
|
||||
from requests.adapters import HTTPAdapter
|
||||
-from six.moves.urllib.parse import urlparse
|
||||
+from urllib.parse import urlparse
|
||||
|
||||
from influxdb.line_protocol import make_lines, quote_ident, quote_literal
|
||||
from influxdb.resultset import ResultSet
|
||||
Index: influxdb-5.3.2/influxdb/helper.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/helper.py
|
||||
+++ influxdb-5.3.2/influxdb/helper.py
|
||||
@@ -10,8 +10,6 @@ from collections import namedtuple, defa
|
||||
from datetime import datetime
|
||||
from warnings import warn
|
||||
|
||||
-import six
|
||||
-
|
||||
|
||||
class SeriesHelper(object):
|
||||
"""Subclass this helper eases writing data points in bulk.
|
||||
@@ -176,7 +174,7 @@ class SeriesHelper(object):
|
||||
json = []
|
||||
if not cls.__initialized__:
|
||||
cls._reset_()
|
||||
- for series_name, data in six.iteritems(cls._datapoints):
|
||||
+ for series_name, data in cls._datapoints.items():
|
||||
for point in data:
|
||||
json_point = {
|
||||
"measurement": series_name,
|
||||
Index: influxdb-5.3.2/influxdb/influxdb08/client.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/influxdb08/client.py
|
||||
+++ influxdb-5.3.2/influxdb/influxdb08/client.py
|
||||
@@ -7,8 +7,7 @@ import json
|
||||
import socket
|
||||
import requests
|
||||
import requests.exceptions
|
||||
-from six.moves import xrange
|
||||
-from six.moves.urllib.parse import urlparse
|
||||
+from urllib.parse import urlparse
|
||||
|
||||
from influxdb import chunked_json
|
||||
|
||||
@@ -294,7 +293,7 @@ class InfluxDBClient(object):
|
||||
"""
|
||||
def list_chunks(data_list, n):
|
||||
"""Yield successive n-sized chunks from l."""
|
||||
- for i in xrange(0, len(data_list), n):
|
||||
+ for i in range(0, len(data_list), n):
|
||||
yield data_list[i:i + n]
|
||||
|
||||
batch_size = kwargs.get('batch_size')
|
||||
Index: influxdb-5.3.2/influxdb/line_protocol.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/line_protocol.py
|
||||
+++ influxdb-5.3.2/influxdb/line_protocol.py
|
||||
@@ -11,7 +11,6 @@ from numbers import Integral
|
||||
|
||||
from pytz import UTC
|
||||
from dateutil.parser import parse
|
||||
-from six import binary_type, text_type, integer_types, PY2
|
||||
|
||||
EPOCH = UTC.localize(datetime.utcfromtimestamp(0))
|
||||
|
||||
@@ -28,7 +27,7 @@ def _convert_timestamp(timestamp, precis
|
||||
if isinstance(timestamp, Integral):
|
||||
return timestamp # assume precision is correct if timestamp is int
|
||||
|
||||
- if isinstance(_get_unicode(timestamp), text_type):
|
||||
+ if isinstance(_get_unicode(timestamp), str):
|
||||
timestamp = parse(timestamp)
|
||||
|
||||
if isinstance(timestamp, datetime):
|
||||
@@ -108,10 +107,10 @@ def _escape_value(value):
|
||||
return ''
|
||||
|
||||
value = _get_unicode(value)
|
||||
- if isinstance(value, text_type):
|
||||
+ if isinstance(value, str):
|
||||
return quote_ident(value)
|
||||
|
||||
- if isinstance(value, integer_types) and not isinstance(value, bool):
|
||||
+ if isinstance(value, int) and not isinstance(value, bool):
|
||||
return str(value) + 'i'
|
||||
|
||||
if isinstance(value, bool):
|
||||
@@ -125,15 +124,13 @@ def _escape_value(value):
|
||||
|
||||
def _get_unicode(data, force=False):
|
||||
"""Try to return a text aka unicode object from the given data."""
|
||||
- if isinstance(data, binary_type):
|
||||
+ if isinstance(data, bytes):
|
||||
return data.decode('utf-8')
|
||||
|
||||
if data is None:
|
||||
return ''
|
||||
|
||||
if force:
|
||||
- if PY2:
|
||||
- return unicode(data)
|
||||
return str(data)
|
||||
|
||||
return data
|
||||
Index: influxdb-5.3.2/requirements.txt
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/requirements.txt
|
||||
+++ influxdb-5.3.2/requirements.txt
|
||||
@@ -1,5 +1,4 @@
|
||||
python-dateutil>=2.6.0
|
||||
pytz
|
||||
requests>=2.17.0
|
||||
-six>=1.10.0
|
||||
msgpack
|
||||
Index: influxdb-5.3.2/influxdb/influxdb08/helper.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/influxdb08/helper.py
|
||||
+++ influxdb-5.3.2/influxdb/influxdb08/helper.py
|
||||
@@ -9,8 +9,6 @@ from __future__ import unicode_literals
|
||||
from collections import namedtuple, defaultdict
|
||||
from warnings import warn
|
||||
|
||||
-import six
|
||||
-
|
||||
|
||||
class SeriesHelper(object):
|
||||
"""Define the SeriesHelper object for InfluxDB v0.8.
|
||||
@@ -141,7 +139,7 @@ class SeriesHelper(object):
|
||||
json = []
|
||||
if not cls.__initialized__:
|
||||
cls._reset_()
|
||||
- for series_name, data in six.iteritems(cls._datapoints):
|
||||
+ for series_name, data in cls._datapoints.items():
|
||||
json.append({'name': series_name,
|
||||
'columns': cls._fields,
|
||||
'points': [[getattr(point, k) for k in cls._fields]
|
730
python-influxdb-remove-nose.patch
Normal file
730
python-influxdb-remove-nose.patch
Normal file
@ -0,0 +1,730 @@
|
||||
Index: influxdb-5.3.2/dev-requirements.txt
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/dev-requirements.txt
|
||||
+++ influxdb-5.3.2/dev-requirements.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
requests>=2.17.0
|
||||
-nose
|
||||
+pytest
|
||||
mock
|
||||
pandas==0.20.1
|
||||
Sphinx==1.5.5
|
||||
Index: influxdb-5.3.2/influxdb/tests/client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/client_test.py
|
||||
+++ influxdb-5.3.2/influxdb/tests/client_test.py
|
||||
@@ -32,7 +32,6 @@ import requests
|
||||
import requests.exceptions
|
||||
import requests_mock
|
||||
|
||||
-from nose.tools import raises
|
||||
from urllib3.connection import HTTPConnection
|
||||
|
||||
from influxdb import InfluxDBClient
|
||||
@@ -383,12 +382,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
received_data.decode()
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_write_points_fails(self):
|
||||
"""Test write points fail for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- with _mocked_session(cli, 'post', 500):
|
||||
- cli.write_points([])
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'post', 500):
|
||||
+ cli.write_points([])
|
||||
|
||||
def test_write_points_with_precision(self):
|
||||
"""Test write points with precision for TestInfluxDBClient object."""
|
||||
@@ -541,12 +540,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
consistency='boo'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_write_points_with_precision_fails(self):
|
||||
"""Test write points w/precision fail for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- with _mocked_session(cli, 'post', 500):
|
||||
- cli.write_points_with_precision([])
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'post', 500):
|
||||
+ cli.write_points_with_precision([])
|
||||
|
||||
def test_query(self):
|
||||
"""Test query method for TestInfluxDBClient object."""
|
||||
@@ -651,11 +650,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
[example_object, example_object]
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_query_fail(self):
|
||||
"""Test query failed for TestInfluxDBClient object."""
|
||||
- with _mocked_session(self.cli, 'get', 401):
|
||||
- self.cli.query('select column_one from foo;')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(self.cli, 'get', 401):
|
||||
+ self.cli.query('select column_one from foo;')
|
||||
|
||||
def test_ping(self):
|
||||
"""Test ping querying InfluxDB version."""
|
||||
@@ -697,11 +696,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'create database "123"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_create_database_fails(self):
|
||||
"""Test create database fail for TestInfluxDBClient object."""
|
||||
- with _mocked_session(self.cli, 'post', 401):
|
||||
- self.cli.create_database('new_db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(self.cli, 'post', 401):
|
||||
+ self.cli.create_database('new_db')
|
||||
|
||||
def test_drop_database(self):
|
||||
"""Test drop database for TestInfluxDBClient object."""
|
||||
@@ -762,12 +761,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
[{'name': 'new_db_1'}, {'name': 'new_db_2'}]
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_database_fails(self):
|
||||
"""Test get list of dbs fail for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 401):
|
||||
- cli.get_list_database()
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 401):
|
||||
+ cli.get_list_database()
|
||||
|
||||
def test_get_list_measurements(self):
|
||||
"""Test get list of measurements for TestInfluxDBClient object."""
|
||||
@@ -840,12 +839,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
self.cli.get_list_series(tags={'region': 'us-west'}),
|
||||
['cpu_load_short,host=server01,region=us-west'])
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_series_fails(self):
|
||||
"""Test get a list of series from the database but fail."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 401):
|
||||
- cli.get_list_series()
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 401):
|
||||
+ cli.get_list_series()
|
||||
|
||||
def test_create_retention_policy_default(self):
|
||||
"""Test create default ret policy for TestInfluxDBClient object."""
|
||||
@@ -971,12 +970,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'alter retention policy "somename" on "db" default'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_alter_retention_policy_invalid(self):
|
||||
"""Test invalid alter ret policy for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- self.cli.alter_retention_policy('somename', 'db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ self.cli.alter_retention_policy('somename', 'db')
|
||||
|
||||
def test_drop_retention_policy(self):
|
||||
"""Test drop retention policy for TestInfluxDBClient object."""
|
||||
@@ -994,12 +993,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'drop retention policy "somename" on "db"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_drop_retention_policy_fails(self):
|
||||
"""Test failed drop ret policy for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'delete', 401):
|
||||
- cli.drop_retention_policy('default', 'db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'delete', 401):
|
||||
+ cli.drop_retention_policy('default', 'db')
|
||||
|
||||
def test_get_list_retention_policies(self):
|
||||
"""Test get retention policies for TestInfluxDBClient object."""
|
||||
@@ -1179,12 +1178,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'grant all privileges to "test"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_grant_admin_privileges_invalid(self):
|
||||
"""Test grant invalid admin privs for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- self.cli.grant_admin_privileges('')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ self.cli.grant_admin_privileges('')
|
||||
|
||||
def test_revoke_admin_privileges(self):
|
||||
"""Test revoke admin privs for TestInfluxDBClient object."""
|
||||
@@ -1203,12 +1202,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'revoke all privileges from "test"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_revoke_admin_privileges_invalid(self):
|
||||
"""Test revoke invalid admin privs for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- self.cli.revoke_admin_privileges('')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ self.cli.revoke_admin_privileges('')
|
||||
|
||||
def test_grant_privilege(self):
|
||||
"""Test grant privs for TestInfluxDBClient object."""
|
||||
@@ -1227,12 +1226,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'grant read on "testdb" to "test"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_grant_privilege_invalid(self):
|
||||
"""Test grant invalid privs for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- self.cli.grant_privilege('', 'testdb', 'test')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ self.cli.grant_privilege('', 'testdb', 'test')
|
||||
|
||||
def test_revoke_privilege(self):
|
||||
"""Test revoke privs for TestInfluxDBClient object."""
|
||||
@@ -1251,12 +1250,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'revoke read on "testdb" from "test"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_revoke_privilege_invalid(self):
|
||||
"""Test revoke invalid privs for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- self.cli.revoke_privilege('', 'testdb', 'test')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ self.cli.revoke_privilege('', 'testdb', 'test')
|
||||
|
||||
def test_get_list_privileges(self):
|
||||
"""Test get list of privs for TestInfluxDBClient object."""
|
||||
@@ -1278,12 +1277,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
{'database': 'db3', 'privilege': 'NO PRIVILEGES'}]
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_privileges_fails(self):
|
||||
"""Test failed get list of privs for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 401):
|
||||
- cli.get_list_privileges('test')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 401):
|
||||
+ cli.get_list_privileges('test')
|
||||
|
||||
def test_get_list_continuous_queries(self):
|
||||
"""Test getting a list of continuous queries."""
|
||||
@@ -1333,11 +1332,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
]
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_continuous_queries_fails(self):
|
||||
"""Test failing to get a list of continuous queries."""
|
||||
- with _mocked_session(self.cli, 'get', 400):
|
||||
- self.cli.get_list_continuous_queries()
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(self.cli, 'get', 400):
|
||||
+ self.cli.get_list_continuous_queries()
|
||||
|
||||
def test_create_continuous_query(self):
|
||||
"""Test continuous query creation."""
|
||||
@@ -1366,11 +1365,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'"6_months"."events" from "events" group by time(10m) end'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_create_continuous_query_fails(self):
|
||||
"""Test failing to create a continuous query."""
|
||||
- with _mocked_session(self.cli, 'get', 400):
|
||||
- self.cli.create_continuous_query('cq_name', 'select', 'db_name')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(self.cli, 'get', 400):
|
||||
+ self.cli.create_continuous_query('cq_name', 'select', 'db_name')
|
||||
|
||||
def test_drop_continuous_query(self):
|
||||
"""Test dropping a continuous query."""
|
||||
@@ -1387,11 +1386,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
'drop continuous query "cq_name" on "db_name"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_drop_continuous_query_fails(self):
|
||||
"""Test failing to drop a continuous query."""
|
||||
- with _mocked_session(self.cli, 'get', 400):
|
||||
- self.cli.drop_continuous_query('cq_name', 'db_name')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(self.cli, 'get', 400):
|
||||
+ self.cli.drop_continuous_query('cq_name', 'db_name')
|
||||
|
||||
def test_invalid_port_fails(self):
|
||||
"""Test invalid port fail for TestInfluxDBClient object."""
|
||||
Index: influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/dataframe_client_test.py
|
||||
+++ influxdb-5.3.2/influxdb/tests/dataframe_client_test.py
|
||||
@@ -13,7 +13,6 @@ import unittest
|
||||
import warnings
|
||||
import requests_mock
|
||||
|
||||
-from nose.tools import raises
|
||||
from influxdb.tests import skip_if_pypy, using_pypy
|
||||
|
||||
from .client_test import _mocked_session
|
||||
@@ -597,35 +596,35 @@ class TestDataFrameClient(unittest.TestC
|
||||
m.last_request.body,
|
||||
)
|
||||
|
||||
- @raises(TypeError)
|
||||
def test_write_points_from_dataframe_fails_without_time_index(self):
|
||||
"""Test failed write points from df without time index."""
|
||||
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
|
||||
columns=["column_one", "column_two",
|
||||
"column_three"])
|
||||
|
||||
- with requests_mock.Mocker() as m:
|
||||
- m.register_uri(requests_mock.POST,
|
||||
- "http://localhost:8086/db/db/series",
|
||||
- status_code=204)
|
||||
+ with self.assertRaises(TypeError):
|
||||
+ with requests_mock.Mocker() as m:
|
||||
+ m.register_uri(requests_mock.POST,
|
||||
+ "http://localhost:8086/db/db/series",
|
||||
+ status_code=204)
|
||||
+
|
||||
+ cli = DataFrameClient(database='db')
|
||||
+ cli.write_points(dataframe, "foo")
|
||||
|
||||
- cli = DataFrameClient(database='db')
|
||||
- cli.write_points(dataframe, "foo")
|
||||
-
|
||||
- @raises(TypeError)
|
||||
def test_write_points_from_dataframe_fails_with_series(self):
|
||||
"""Test failed write points from df with series."""
|
||||
now = pd.Timestamp('1970-01-01 00:00+00:00')
|
||||
dataframe = pd.Series(data=[1.0, 2.0],
|
||||
index=[now, now + timedelta(hours=1)])
|
||||
|
||||
- with requests_mock.Mocker() as m:
|
||||
- m.register_uri(requests_mock.POST,
|
||||
- "http://localhost:8086/db/db/series",
|
||||
- status_code=204)
|
||||
-
|
||||
- cli = DataFrameClient(database='db')
|
||||
- cli.write_points(dataframe, "foo")
|
||||
+ with self.assertRaises(TypeError):
|
||||
+ with requests_mock.Mocker() as m:
|
||||
+ m.register_uri(requests_mock.POST,
|
||||
+ "http://localhost:8086/db/db/series",
|
||||
+ status_code=204)
|
||||
+
|
||||
+ cli = DataFrameClient(database='db')
|
||||
+ cli.write_points(dataframe, "foo")
|
||||
|
||||
def test_create_database(self):
|
||||
"""Test create database for TestInfluxDBClient object."""
|
||||
@@ -657,12 +656,12 @@ class TestDataFrameClient(unittest.TestC
|
||||
'create database "123"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_create_database_fails(self):
|
||||
"""Test create database fail for TestInfluxDBClient object."""
|
||||
cli = DataFrameClient(database='db')
|
||||
- with _mocked_session(cli, 'post', 401):
|
||||
- cli.create_database('new_db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'post', 401):
|
||||
+ cli.create_database('new_db')
|
||||
|
||||
def test_drop_database(self):
|
||||
"""Test drop database for TestInfluxDBClient object."""
|
||||
@@ -709,12 +708,12 @@ class TestDataFrameClient(unittest.TestC
|
||||
'drop database "123"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_database_fails(self):
|
||||
"""Test get list of dbs fail for TestInfluxDBClient object."""
|
||||
cli = DataFrameClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 401):
|
||||
- cli.get_list_database()
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 401):
|
||||
+ cli.get_list_database()
|
||||
|
||||
def test_get_list_measurements(self):
|
||||
"""Test get list of measurements for TestInfluxDBClient object."""
|
||||
@@ -819,12 +818,12 @@ class TestDataFrameClient(unittest.TestC
|
||||
'alter retention policy "somename" on "db" default'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_alter_retention_policy_invalid(self):
|
||||
"""Test invalid alter ret policy for TestInfluxDBClient object."""
|
||||
cli = DataFrameClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'get', 400):
|
||||
- cli.alter_retention_policy('somename', 'db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'get', 400):
|
||||
+ cli.alter_retention_policy('somename', 'db')
|
||||
|
||||
def test_drop_retention_policy(self):
|
||||
"""Test drop retention policy for TestInfluxDBClient object."""
|
||||
@@ -843,12 +842,12 @@ class TestDataFrameClient(unittest.TestC
|
||||
'drop retention policy "somename" on "db"'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_drop_retention_policy_fails(self):
|
||||
"""Test failed drop ret policy for TestInfluxDBClient object."""
|
||||
cli = DataFrameClient('host', 8086, 'username', 'password')
|
||||
- with _mocked_session(cli, 'delete', 401):
|
||||
- cli.drop_retention_policy('default', 'db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session(cli, 'delete', 401):
|
||||
+ cli.drop_retention_policy('default', 'db')
|
||||
|
||||
def test_get_list_retention_policies(self):
|
||||
"""Test get retention policies for TestInfluxDBClient object."""
|
||||
Index: influxdb-5.3.2/influxdb/tests/influxdb08/client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/influxdb08/client_test.py
|
||||
+++ influxdb-5.3.2/influxdb/tests/influxdb08/client_test.py
|
||||
@@ -13,7 +13,6 @@ import requests
|
||||
import requests.exceptions
|
||||
import requests_mock
|
||||
|
||||
-from nose.tools import raises
|
||||
from mock import patch
|
||||
|
||||
from influxdb.influxdb08 import InfluxDBClient
|
||||
@@ -131,12 +130,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
cli.switch_database('another_database')
|
||||
self.assertEqual(cli._database, 'another_database')
|
||||
|
||||
- @raises(FutureWarning)
|
||||
def test_switch_db_deprecated(self):
|
||||
"""Test deprecated switch database for TestInfluxDBClient object."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'database')
|
||||
- cli.switch_db('another_database')
|
||||
- self.assertEqual(cli._database, 'another_database')
|
||||
+ with self.assertRaises(FutureWarning):
|
||||
+ cli.switch_db('another_database')
|
||||
+ self.assertEqual(cli._database, 'another_database')
|
||||
|
||||
def test_switch_user(self):
|
||||
"""Test switch user for TestInfluxDBClient object."""
|
||||
@@ -288,12 +287,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
time_precision='ms'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_write_points_fails(self):
|
||||
"""Test failed write points for TestInfluxDBClient object."""
|
||||
- with _mocked_session('post', 500):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.write_points([])
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('post', 500):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.write_points([])
|
||||
|
||||
def test_write_points_with_precision(self):
|
||||
"""Test write points with precision."""
|
||||
@@ -313,12 +312,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
time_precision='g'
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_write_points_with_precision_fails(self):
|
||||
"""Test write points where precision fails."""
|
||||
- with _mocked_session('post', 500):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.write_points_with_precision([])
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('post', 500):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.write_points_with_precision([])
|
||||
|
||||
def test_delete_points(self):
|
||||
"""Test delete points for TestInfluxDBClient object."""
|
||||
@@ -333,30 +332,30 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
{'u': 'username', 'p': 'password'})
|
||||
self.assertEqual(kwds['url'], 'http://host:8086/db/db/series/foo')
|
||||
|
||||
- @raises(Exception)
|
||||
def test_delete_points_with_wrong_name(self):
|
||||
"""Test delete points with wrong name."""
|
||||
- with _mocked_session('delete', 400):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.delete_points("nonexist")
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('delete', 400):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.delete_points("nonexist")
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_create_scheduled_delete(self):
|
||||
"""Test create scheduled deletes."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.create_scheduled_delete([])
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.create_scheduled_delete([])
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_get_list_scheduled_delete(self):
|
||||
"""Test get schedule list of deletes TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.get_list_scheduled_delete()
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.get_list_scheduled_delete()
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_remove_scheduled_delete(self):
|
||||
"""Test remove scheduled delete TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.remove_scheduled_delete(1)
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.remove_scheduled_delete(1)
|
||||
|
||||
def test_query(self):
|
||||
"""Test query for TestInfluxDBClient object."""
|
||||
@@ -438,12 +437,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
[example_object, example_object]
|
||||
)
|
||||
|
||||
- @raises(Exception)
|
||||
def test_query_fail(self):
|
||||
"""Test failed query for TestInfluxDBClient."""
|
||||
- with _mocked_session('get', 401):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.query('select column_one from foo;')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('get', 401):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.query('select column_one from foo;')
|
||||
|
||||
def test_query_bad_precision(self):
|
||||
"""Test query with bad precision for TestInfluxDBClient."""
|
||||
@@ -460,12 +459,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
self.assertTrue(cli.create_database('new_db'))
|
||||
|
||||
- @raises(Exception)
|
||||
def test_create_database_fails(self):
|
||||
"""Test failed create database for TestInfluxDBClient."""
|
||||
- with _mocked_session('post', 401):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.create_database('new_db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('post', 401):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.create_database('new_db')
|
||||
|
||||
def test_delete_database(self):
|
||||
"""Test delete database for TestInfluxDBClient."""
|
||||
@@ -473,12 +472,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
self.assertTrue(cli.delete_database('old_db'))
|
||||
|
||||
- @raises(Exception)
|
||||
def test_delete_database_fails(self):
|
||||
"""Test failed delete database for TestInfluxDBClient."""
|
||||
- with _mocked_session('delete', 401):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.delete_database('old_db')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('delete', 401):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.delete_database('old_db')
|
||||
|
||||
def test_get_list_database(self):
|
||||
"""Test get list of databases for TestInfluxDBClient."""
|
||||
@@ -490,23 +489,23 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
self.assertEqual(len(cli.get_list_database()), 1)
|
||||
self.assertEqual(cli.get_list_database()[0]['name'], 'a_db')
|
||||
|
||||
- @raises(Exception)
|
||||
def test_get_list_database_fails(self):
|
||||
"""Test failed get list of databases for TestInfluxDBClient."""
|
||||
- with _mocked_session('get', 401):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- cli.get_list_database()
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('get', 401):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
+ cli.get_list_database()
|
||||
|
||||
- @raises(FutureWarning)
|
||||
def test_get_database_list_deprecated(self):
|
||||
"""Test deprecated get database list for TestInfluxDBClient."""
|
||||
data = [
|
||||
{"name": "a_db"}
|
||||
]
|
||||
- with _mocked_session('get', 200, data):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
- self.assertEqual(len(cli.get_database_list()), 1)
|
||||
- self.assertEqual(cli.get_database_list()[0]['name'], 'a_db')
|
||||
+ with self.assertRaises(FutureWarning):
|
||||
+ with _mocked_session('get', 200, data):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password')
|
||||
+ self.assertEqual(len(cli.get_database_list()), 1)
|
||||
+ self.assertEqual(cli.get_database_list()[0]['name'], 'a_db')
|
||||
|
||||
def test_delete_series(self):
|
||||
"""Test delete series for TestInfluxDBClient."""
|
||||
@@ -514,12 +513,12 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
cli.delete_series('old_series')
|
||||
|
||||
- @raises(Exception)
|
||||
def test_delete_series_fails(self):
|
||||
"""Test failed delete series for TestInfluxDBClient."""
|
||||
- with _mocked_session('delete', 401):
|
||||
- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.delete_series('old_series')
|
||||
+ with self.assertRaises(Exception):
|
||||
+ with _mocked_session('delete', 401):
|
||||
+ cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
+ cli.delete_series('old_series')
|
||||
|
||||
def test_get_series_list(self):
|
||||
"""Test get list of series for TestInfluxDBClient."""
|
||||
@@ -662,29 +661,29 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
}
|
||||
)
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_get_list_database_admins(self):
|
||||
"""Test get list of database admins for TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.get_list_database_admins()
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.get_list_database_admins()
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_add_database_admin(self):
|
||||
"""Test add database admins for TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.add_database_admin('admin', 'admin_secret_password')
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.add_database_admin('admin', 'admin_secret_password')
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_update_database_admin_password(self):
|
||||
"""Test update database admin pass for TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.update_database_admin_password('admin', 'admin_secret_password')
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.update_database_admin_password('admin', 'admin_secret_password')
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_delete_database_admin(self):
|
||||
"""Test delete database admin for TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.delete_database_admin('admin')
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.delete_database_admin('admin')
|
||||
|
||||
def test_get_database_users(self):
|
||||
"""Test get database users for TestInfluxDBClient."""
|
||||
@@ -842,11 +841,11 @@ class TestInfluxDBClient(unittest.TestCa
|
||||
|
||||
self.assertIsNone(m.last_request.body)
|
||||
|
||||
- @raises(NotImplementedError)
|
||||
def test_update_permission(self):
|
||||
"""Test update permission for TestInfluxDBClient."""
|
||||
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
|
||||
- cli.update_permission('admin', [])
|
||||
+ with self.assertRaises(NotImplementedError):
|
||||
+ cli.update_permission('admin', [])
|
||||
|
||||
@mock.patch('requests.Session.request')
|
||||
def test_request_retry(self, mock_request):
|
||||
Index: influxdb-5.3.2/influxdb/tests/influxdb08/dataframe_client_test.py
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/influxdb/tests/influxdb08/dataframe_client_test.py
|
||||
+++ influxdb-5.3.2/influxdb/tests/influxdb08/dataframe_client_test.py
|
||||
@@ -10,8 +10,6 @@ import warnings
|
||||
|
||||
import requests_mock
|
||||
|
||||
-from nose.tools import raises
|
||||
-
|
||||
from influxdb.tests import skip_if_pypy, using_pypy
|
||||
|
||||
from .client_test import _mocked_session
|
||||
@@ -191,33 +189,33 @@ class TestDataFrameClient(unittest.TestC
|
||||
cli.write_points({"foo": dataframe}, time_precision='u')
|
||||
self.assertListEqual(json.loads(m.last_request.body), points_us)
|
||||
|
||||
- @raises(TypeError)
|
||||
def test_write_points_from_dataframe_fails_without_time_index(self):
|
||||
"""Test write points from dataframe that fails without time index."""
|
||||
dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
|
||||
columns=["column_one", "column_two",
|
||||
"column_three"])
|
||||
|
||||
- with requests_mock.Mocker() as m:
|
||||
- m.register_uri(requests_mock.POST,
|
||||
- "http://localhost:8086/db/db/series")
|
||||
-
|
||||
- cli = DataFrameClient(database='db')
|
||||
- cli.write_points({"foo": dataframe})
|
||||
+ with self.assertRaises(TypeError):
|
||||
+ with requests_mock.Mocker() as m:
|
||||
+ m.register_uri(requests_mock.POST,
|
||||
+ "http://localhost:8086/db/db/series")
|
||||
+
|
||||
+ cli = DataFrameClient(database='db')
|
||||
+ cli.write_points({"foo": dataframe})
|
||||
|
||||
- @raises(TypeError)
|
||||
def test_write_points_from_dataframe_fails_with_series(self):
|
||||
"""Test failed write points from dataframe with series."""
|
||||
now = pd.Timestamp('1970-01-01 00:00+00:00')
|
||||
dataframe = pd.Series(data=[1.0, 2.0],
|
||||
index=[now, now + timedelta(hours=1)])
|
||||
|
||||
- with requests_mock.Mocker() as m:
|
||||
- m.register_uri(requests_mock.POST,
|
||||
- "http://localhost:8086/db/db/series")
|
||||
-
|
||||
- cli = DataFrameClient(database='db')
|
||||
- cli.write_points({"foo": dataframe})
|
||||
+ with self.assertRaises(TypeError):
|
||||
+ with requests_mock.Mocker() as m:
|
||||
+ m.register_uri(requests_mock.POST,
|
||||
+ "http://localhost:8086/db/db/series")
|
||||
+
|
||||
+ cli = DataFrameClient(database='db')
|
||||
+ cli.write_points({"foo": dataframe})
|
||||
|
||||
def test_query_into_dataframe(self):
|
||||
"""Test query into a dataframe."""
|
||||
Index: influxdb-5.3.2/test-requirements.txt
|
||||
===================================================================
|
||||
--- influxdb-5.3.2.orig/test-requirements.txt
|
||||
+++ influxdb-5.3.2/test-requirements.txt
|
||||
@@ -1,4 +1,4 @@
|
||||
-nose
|
||||
-nose-cov
|
||||
+pytest
|
||||
+pytest-cov
|
||||
mock
|
||||
requests-mock
|
201
python-influxdb.changes
Normal file
201
python-influxdb.changes
Normal file
@ -0,0 +1,201 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 11 10:54:28 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
- Update to 5.3.2:
|
||||
* Correctly serialize nanosecond dataframe timestamps (#926)
|
||||
- Refresh all patches and skip broken test with numpy >= 2
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 8 15:47:41 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update python-influxdb-new-pandas.patch once more
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Feb 18 12:38:12 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Skip python312 flavor. This legacy package is not compatible with
|
||||
Python 3.12. Makes gh#openSUSE/openSUSE-release-tools#3034 more
|
||||
pressing.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 24 18:51:23 UTC 2023 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Update python-influxdb-new-pandas.patch in order to avoid
|
||||
FutureWarning: does not work with pandas < 2.1
|
||||
- Make pure python a noarch package
|
||||
- PEP 517
|
||||
- Upstream is archived, but still required by
|
||||
openSUSE-release-tools gh#openSUSE/openSUSE-release-tools#3034
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 19 08:47:41 UTC 2023 - Fabian Vogt <fvogt@suse.com>
|
||||
|
||||
- Add patch to fix tests with newer pandas:
|
||||
* python-influxdb-new-pandas.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 2 08:59:55 UTC 2023 - pgajdos@suse.com
|
||||
|
||||
- do not require six
|
||||
- modified patches
|
||||
% python-influxdb-remove-nose.patch (refreshed)
|
||||
- added patches
|
||||
do not require six (repo archived in favour of influxdb2, not reporting)
|
||||
+ python-influxdb-no-six.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 9 16:05:29 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||
|
||||
- Sync ExcludeArch with influxdb. By definition, this package is no
|
||||
longer noarch, as it's not usable/installable on all
|
||||
architectures (missing deps).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 15 14:29:34 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Skip python36: Extensive use of pandas in the test suite
|
||||
- Add influxdb-pr845-pandas-future.patch
|
||||
gh#influxdb/influxdb-python#845
|
||||
- Skip tests failing with pandas -- #influxdb/influxdb-python#884
|
||||
- Don't use extra mock
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 2 00:19:18 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 5.3.1:
|
||||
* Add support for custom headers in the InfluxDBClient
|
||||
* Add support for custom indexes for query in the DataFrameClient
|
||||
* Amend retry to avoid sleep after last retry before raising exception
|
||||
* Remove msgpack pinning for requirements
|
||||
* Update support for HTTP headers in the InfluxDBClient
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 8 16:04:53 UTC 2020 - pgajdos@suse.com
|
||||
|
||||
- do not depend on deprecated nose
|
||||
- added patches
|
||||
https://github.com/influxdata/influxdb-python/pull/835
|
||||
+ python-influxdb-remove-nose.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 14 12:43:25 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
|
||||
|
||||
- Update to 5.3.0
|
||||
* Add mypy testing framework (#756)
|
||||
* Add support for messagepack (#734 thx @lovasoa)
|
||||
* Add support for 'show series' (#357 thx @gaker)
|
||||
* Add support for custom request session in InfluxDBClient (#360 thx @dschien)
|
||||
* Add support for handling np.nan and np.inf values in DataFrameClient (#436 thx @nmerket)
|
||||
* Add support for optional `time_precision` in the SeriesHelper (#502 && #719 thx @appunni-dishq && @klDen)
|
||||
* Add ability to specify retention policy in SeriesHelper (#723 thx @csanz91)
|
||||
* Add gzip compression for post and response data (#732 thx @KEClaytor)
|
||||
* Add support for chunked responses in ResultSet (#753 and #538 thx @hrbonz && @psy0rz)
|
||||
* Add support for empty string fields (#766 thx @gregschrock)
|
||||
* Add support for context managers to InfluxDBClient (#721 thx @JustusAdam)
|
||||
* Clean up stale CI config (#755)
|
||||
* Add legacy client test (#752 & #318 thx @oldmantaiter & @sebito91)
|
||||
* Update make_lines section in line_protocol.py to split out core function (#375 thx @aisbaa)
|
||||
* Fix nanosecond time resolution for points (#407 thx @AndreCAndersen && @clslgrnc)
|
||||
* Fix import of distutils.spawn (#805 thx @Hawk777)
|
||||
* Update repr of float values including properly handling of boolean (#488 thx @ghost)
|
||||
* Update DataFrameClient to fix faulty empty tags (#770 thx @michelfripiat)
|
||||
* Update DataFrameClient to properly return `dropna` values (#778 thx @jgspiro)
|
||||
* Update DataFrameClient to test for pd.DataTimeIndex before blind conversion (#623 thx @testforvin)
|
||||
* Update client to type-set UDP port to int (#651 thx @yifeikong)
|
||||
* Update batched writing support for all iterables (#746 thx @JayH5)
|
||||
* Update SeriesHelper to enable class instantiation when not initialized (#772 thx @ocworld)
|
||||
* Update UDP test case to add proper timestamp to datapoints (#808 thx @shantanoo-desai)
|
||||
- Drop upstreamed patch python-influxdb-fix-testsuite.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 10 08:37:48 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
||||
|
||||
- skip python 2.x build (pandas went py3 only)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 11 14:50:13 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Update to 5.2.3:
|
||||
* Add consistency param to InfluxDBClient.write_points (#643 thx @RonRothman)
|
||||
* Add UDP example (#648 thx @shantanoo-desai)
|
||||
* Add consistency paramter to write_points (#664 tx @RonRothman)
|
||||
* The query() function now accepts a bind_params argument for parameter binding (#678 thx @clslgrnc)
|
||||
* Add get_list_continuous_queries, drop_continuous_query, and create_continuous_query management methods for continuous queries (#681 thx @lukaszdudek-silvair)
|
||||
* Mutual TLS authentication (#702 thx @LloydW93)
|
||||
- Drop merged patches:
|
||||
* python-influxdb-d5d1249.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri May 10 11:23:44 UTC 2019 - pgajdos@suse.com
|
||||
|
||||
- version update to 5.2.2
|
||||
- Fix 'TypeError: Already tz-aware' introduced with recent versions of Panda
|
||||
(#671, #676, thx @f4bsch @clslgrnc)
|
||||
- Pass through the "method" kwarg to DataFrameClient queries
|
||||
- Finally add a CHANGELOG.md to communicate breaking changes (#598)
|
||||
- Test multiple versions of InfluxDB in travis
|
||||
- Add SHARD DURATION parameter to retention policy create/alter
|
||||
- Update POST/GET requests to follow verb guidelines from InfluxDB documentation
|
||||
- Update test suite to support InfluxDB v1.3.9, v1.4.2, and v1.5.4
|
||||
- Fix performance degradation when removing NaN values via line protocol (#592)
|
||||
- Dropped support for Python3.4
|
||||
- added patches
|
||||
recent changes in master to fix tests
|
||||
+ python-influxdb-d5d1249.patch
|
||||
fix module 'distutils' has no attribute 'spawn'
|
||||
+ python-influxdb-fix-testsuite.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Jan 27 06:43:00 UTC 2019 - Thomas Bechtold <tbechtold@suse.com>
|
||||
|
||||
- update to version v5.1.0
|
||||
* README: add PyPI status
|
||||
* Escape tag values that ends with backslash (#537)
|
||||
* Fix for DataFrameClient issue - seems does not process correctly DateTimeIndex dates (issue #479) (#495)
|
||||
* Fix pandas example (#547)
|
||||
* Fix wrong session mount (#571)
|
||||
* set version to 5.1.0
|
||||
* DataFrameClient should escape measurement names (#542)
|
||||
* doc: clarify that send_packet takes a list (#545)
|
||||
* specify the numpy dependency explicitly to prevent regression in test (#563)
|
||||
* Parse column names in a dataframe to avoid breaking the line protocol (#584)
|
||||
* adding back dropped database param
|
||||
* Allow connecting to influxdb running on a path on the server (#556)
|
||||
* Remove comment as issues have been resolved (#581)
|
||||
* Remove UDP Precision Restrictions (#557)
|
||||
* Update _dataframe_client.py (#593)
|
||||
* README: styling
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 4 12:49:20 UTC 2018 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Remove superfluous devel dependency for noarch package
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 22 18:32:54 UTC 2017 - mimi.vx@gmail.com
|
||||
|
||||
- convert to singlespec
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 21 17:56:20 UTC 2017 - ncutler@suse.com
|
||||
|
||||
- spec file
|
||||
+ "hostname" build dependency only for Leap 15 and above
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 21 17:05:52 UTC 2017 - ncutler@suse.com
|
||||
|
||||
- update to 5.0.0
|
||||
for detailed change log, see https://github.com/influxdata/influxdb-python/commits/b59fe97
|
||||
- add "hostname" build dependency
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 10 09:37:39 UTC 2017 - dmueller@suse.com
|
||||
|
||||
- remove unnecessary build requires
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 16 12:37:01 UTC 2017 - dmueller@suse.com
|
||||
|
||||
- Initial packaging (4.0.0)
|
||||
|
95
python-influxdb.spec
Normal file
95
python-influxdb.spec
Normal file
@ -0,0 +1,95 @@
|
||||
#
|
||||
# spec file for package python-influxdb
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
# Legacy package not compatible with Python 3.12. Move your consuming library to a more modern version!
|
||||
%define skip_python312 1
|
||||
Name: python-influxdb
|
||||
Version: 5.3.2
|
||||
Release: 0
|
||||
Summary: InfluxDB client
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/influxdb/influxdb-python
|
||||
Source: https://files.pythonhosted.org/packages/source/i/influxdb/influxdb-%{version}.tar.gz
|
||||
# https://github.com/influxdata/influxdb-python/pull/835
|
||||
Patch0: python-influxdb-remove-nose.patch
|
||||
# PATCH-FIX-UPSTREAM influxdb-pr845-pandas-future.patch -- gh#influxdb/influxdb-python#845
|
||||
Patch1: influxdb-pr845-pandas-future.patch
|
||||
# do not require six (repo archived in favour of influxdb2, not reporting)
|
||||
Patch2: python-influxdb-no-six.patch
|
||||
# fix tests with newer pandas
|
||||
Patch3: python-influxdb-new-pandas.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module python-dateutil >= 2.6.0}
|
||||
BuildRequires: %{python_module pytz}
|
||||
BuildRequires: %{python_module requests >= 2.17.0}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-msgpack
|
||||
Requires: python-python-dateutil >= 2.6.0
|
||||
Requires: python-pytz
|
||||
Requires: python-requests >= 2.17.0
|
||||
# Pandas is optional but only works with pandas >= 2.1. If pandas < 2.1 is installed, the module throws an ImportError
|
||||
Conflicts: python-pandas < 2.1
|
||||
ExcludeArch: %ix86 %arm ppc
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module msgpack}
|
||||
BuildRequires: %{python_module pandas >= 2.1}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module requests-mock}
|
||||
BuildRequires: influxdb
|
||||
%if 0%{?suse_version} >= 1500
|
||||
BuildRequires: hostname
|
||||
%endif
|
||||
# /SECTION
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
InfluxDB-Python is a client for interacting with InfluxDB 1.x
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n influxdb-%{version}
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
# remove extra mock
|
||||
sed -e 's/^import mock/from unittest import mock/' \
|
||||
-e 's/^from mock import/from unittest.mock import/' \
|
||||
-i influxdb/tests/*.py influxdb/tests/*/*.py
|
||||
# https://github.com/influxdata/influxdb-python/issues/884
|
||||
donttest="test_write_points_from_dataframe_with_nan_json or test_write_points_from_dataframe_with_tags_and_nan_json"
|
||||
# don't work with numpy 2
|
||||
donttest+=" or test_multiquery_into_dataframe_dropna"
|
||||
%pytest influxdb -k "not ($donttest)"
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc README.rst
|
||||
%{python_sitelib}/influxdb
|
||||
%{python_sitelib}/influxdb-%{version}.dist-info
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user