Skip to content

Commit 9d952df

Browse files
committed
feat: add test for warnings
1 parent 6b91b07 commit 9d952df

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

influxdb_client/client/warnings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class CloudOnlyWarning(UserWarning):
3737
@staticmethod
3838
def print_warning(api_name: str, doc_url: str):
3939
"""Print warning about availability only on the InfluxDB Cloud."""
40-
4140
message = f"""The '{api_name}' is available only on the InfluxDB Cloud.
4241
4342
For more info see:

tests/test_Warnings.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import unittest
2+
3+
import pytest
4+
5+
from influxdb_client import InfluxDBClient, BucketSchemasService
6+
from influxdb_client.client.warnings import CloudOnlyWarning
7+
8+
9+
class PointWarnings(unittest.TestCase):
10+
11+
def test_cloud_only_warning(self):
12+
with pytest.warns(CloudOnlyWarning) as warnings:
13+
with InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org") as client:
14+
BucketSchemasService(api_client=client.api_client)
15+
self.assertEqual(1, len(warnings))

0 commit comments

Comments
 (0)