influxdata / influxdb-python

Python client for InfluxDB
MIT License
1.7k stars 522 forks source link

Test suite failures with pandas 1.2.3 #884

Open bnavigator opened 3 years ago

bnavigator commented 3 years ago

pytest tracebacks:

[   49s] =================================== FAILURES ===================================
[   49s] ______ TestDataFrameClient.test_write_points_from_dataframe_with_nan_json ______
[   49s] 
[   49s] self = <influxdb.tests.dataframe_client_test.TestDataFrameClient testMethod=test_write_points_from_dataframe_with_nan_json>
[   49s] 
[   49s]     def test_write_points_from_dataframe_with_nan_json(self):
[   49s]         """Test write points from json with NaN lines."""
[   49s]         now = pd.Timestamp('1970-01-01 00:00+00:00')
[   49s]         dataframe = pd.DataFrame(data=[["1", 1, np.inf], ["2", 2, np.nan]],
[   49s]                                  index=[now, now + timedelta(hours=1)],
[   49s]                                  columns=["column_one", "column_two",
[   49s]                                           "column_three"])
[   49s]         expected = (
[   49s]             b"foo column_one=\"1\",column_two=1i 0\n"
[   49s]             b"foo column_one=\"2\",column_two=2i "
[   49s]             b"3600000000000\n"
[   49s]         )
[   49s]     
[   49s]         with requests_mock.Mocker() as m:
[   49s]             m.register_uri(requests_mock.POST,
[   49s]                            "http://localhost:8086/write",
[   49s]                            status_code=204)
[   49s]     
[   49s]             cli = DataFrameClient(database='db')
[   49s]     
[   49s]             cli.write_points(dataframe, 'foo', protocol='json')
[   49s] >           self.assertEqual(m.last_request.body, expected)
[   49s] E           AssertionError: b'foo column_one=1.0,column_two=1.0 0\nfoo column_one="2",[25 chars]00\n' != b'foo column_one="1",column_two=1i 0\nfoo column_one="2",c[24 chars]00\n'
[   49s] 
[   49s] influxdb/tests/dataframe_client_test.py:1174: AssertionError
[   49s] _ TestDataFrameClient.test_write_points_from_dataframe_with_tags_and_nan_json __
[   49s] 
[   49s] self = <influxdb.tests.dataframe_client_test.TestDataFrameClient testMethod=test_write_points_from_dataframe_with_tags_and_nan_json>
[   49s] 
[   49s]     def test_write_points_from_dataframe_with_tags_and_nan_json(self):
[   49s]         """Test write points from json with NaN lines and tags."""
[   49s]         now = pd.Timestamp('1970-01-01 00:00+00:00')
[   49s]         dataframe = pd.DataFrame(data=[['blue', 1, "1", 1, np.inf],
[   49s]                                        ['red', 0, "2", 2, np.nan]],
[   49s]                                  index=[now, now + timedelta(hours=1)],
[   49s]                                  columns=["tag_one", "tag_two", "column_one",
[   49s]                                           "column_two", "column_three"])
[   49s]         expected = (
[   49s]             b"foo,tag_one=blue,tag_two=1 "
[   49s]             b"column_one=\"1\",column_two=1i "
[   49s]             b"0\n"
[   49s]             b"foo,tag_one=red,tag_two=0 "
[   49s]             b"column_one=\"2\",column_two=2i "
[   49s]             b"3600000000000\n"
[   49s]         )
[   49s]     
[   49s]         with requests_mock.Mocker() as m:
[   49s]             m.register_uri(requests_mock.POST,
[   49s]                            "http://localhost:8086/write",
[   49s]                            status_code=204)
[   49s]     
[   49s]             cli = DataFrameClient(database='db')
[   49s]     
[   49s]             cli.write_points(dataframe, 'foo', protocol='json',
[   49s]                              tag_columns=['tag_one', 'tag_two'])
[   49s] >           self.assertEqual(m.last_request.body, expected)
[   49s] E           AssertionError: b'foo[30 chars]_one=1.0,column_two=1.0 0\nfoo,tag_one=red,tag[47 chars]00\n' != b'foo[30 chars]_one="1",column_two=1i 0\nfoo,tag_one=red,tag_[46 chars]00\n'
[   49s] 
[   49s] influxdb/tests/dataframe_client_test.py:1237: AssertionError

Full rpmbuild log: influxdb_log.txt

Note the column_one=1.0,column_two=1.0 for the first row.