Skip to content

Commit f256fc6

Browse files
committed
tests: remove tests for removed UPSMultiExporter, further cleanup
1 parent 98e8e70 commit f256fc6

File tree

3 files changed

+13
-46
lines changed

3 files changed

+13
-46
lines changed

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ classifiers = [
1717
"Programming Language :: Python :: 3",
1818
]
1919
dependencies = [
20+
'httpx',
2021
'prometheus_client',
2122
'requests',
2223
]
2324

25+
2426
[project.urls]
2527
"Bug Reports" = "https://github.com/psyinfra/prometheus-eaton-ups-exporter/issues"
2628
"Source" = "https://github.com/psyinfra/prometheus-eaton-ups-exporter/"
@@ -30,6 +32,7 @@ tests = [
3032
'flake8',
3133
'pyre-check',
3234
'pytest == 7.2.1',
35+
'pytest-asyncio',
3336
'pytest-vcr',
3437
]
3538

tests/test_prometheus_api_exporter.py

+1-37
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,9 @@
33
"""
44
import pytest
55
from . import first_ups_details
6-
from prometheus_eaton_ups_exporter.exporter import (
7-
UPSExporter,
8-
UPSMultiExporter,
9-
)
6+
from prometheus_eaton_ups_exporter.exporter import UPSExporter
107

118

12-
# Create Multi Exporter
13-
@pytest.fixture(scope="function")
14-
def single_exporter(ups_scraper_conf) -> UPSExporter:
15-
address, auth, ups_name = first_ups_details(ups_scraper_conf)
16-
return UPSExporter(
17-
address,
18-
auth,
19-
ups_name,
20-
insecure=True,
21-
verbose=True
22-
)
23-
24-
25-
# Create Multi Exporter
26-
@pytest.fixture(scope="function")
27-
def multi_exporter(ups_scraper_conf) -> UPSMultiExporter:
28-
return UPSMultiExporter(
29-
ups_scraper_conf,
30-
insecure=True,
31-
verbose=True
32-
)
33-
34-
35-
# Create Multi Exporter
36-
@pytest.fixture(scope="function")
37-
def threading_multi_exporter(ups_scraper_conf) -> UPSMultiExporter:
38-
return UPSMultiExporter(
39-
ups_scraper_conf,
40-
insecure=True,
41-
verbose=True,
42-
threading=True
43-
)
44-
459

4610
@pytest.mark.vcr()
4711
def test_single_collect(ups_scraper_conf, single_exporter) -> None:

tests/test_ups_api_scraper.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ def scraper_fixture(ups_scraper_conf):
3636
)
3737
return ups_scraper(address, auth, ups_name)
3838

39-
39+
@pytest.mark.asyncio
4040
@pytest.mark.vcr()
41-
def test_login(scraper_fixture) -> None:
42-
token_type, access_token = scraper_fixture.login()
41+
async def test_login(scraper_fixture) -> None:
42+
token_type, access_token = await scraper_fixture.login()
4343
assert token_type == "Bearer"
4444

45-
45+
@pytest.mark.asyncio
4646
@pytest.mark.vcr()
47-
def test_load_rest_api(scraper_fixture) -> None:
47+
async def test_load_rest_api(scraper_fixture) -> None:
4848
"""Tests load_page function with rest api."""
49-
request = scraper_fixture.load_page(
49+
request = await scraper_fixture.load_page(
5050
scraper_fixture.ups_address + REST_API_PATH
5151
)
5252
# Todo
@@ -59,10 +59,10 @@ def test_load_rest_api(scraper_fixture) -> None:
5959
]
6060
assert response_keys == list(json_response.keys())
6161

62-
62+
@pytest.mark.asyncio
6363
@pytest.mark.vcr()
64-
def test_get_measures(scraper_fixture) -> None:
65-
measures = scraper_fixture.get_measures()
64+
async def test_get_measures(scraper_fixture) -> None:
65+
measures = await scraper_fixture.get_measures()
6666
measures_keys = [
6767
'ups_id',
6868
'ups_inputs',

0 commit comments

Comments
 (0)