Skip to content

Commit 01d4b9b

Browse files
LucaNicosiaddutt
authored andcommitted
fix private class access + useless asyncio
Signed-off-by: LucaNicosia <[email protected]>
1 parent 2d66529 commit 01d4b9b

File tree

5 files changed

+33
-39
lines changed

5 files changed

+33
-39
lines changed

tests/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import pandas as pd
1212
import pytest
1313
import yaml
14-
from _pytest.mark.structures import Mark, MarkDecorator
1514
from filelock import FileLock
1615

1716
from nubia import Nubia
@@ -41,7 +40,7 @@
4140
for k, v in SqCommand.get_plugins().items()
4241
if k not in ['TopmemCmd', 'TopcpuCmd']]
4342

44-
tables = get_tables()
43+
tables = [t for t in get_tables() if t not in ['topmem', 'topcpu']]
4544

4645

4746
@pytest.fixture(scope='session')
@@ -209,7 +208,7 @@ def load_up_the_tests(folder):
209208
# the marks MUST be registered in pytest.ini
210209
markers = []
211210
if 'marks' in t:
212-
markers = [MarkDecorator(Mark(x, [], {}))
211+
markers = [getattr(pytest.mark, x)
213212
for x in t['marks'].split()]
214213
if 'xfail' in t:
215214
except_err = None

tests/integration/test_rest.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
import warnings
55

66
import pytest
7-
from _pytest.mark.structures import Mark, MarkDecorator
87
import pandas as pd
98
from fastapi.testclient import TestClient
109

11-
from tests.conftest import cli_commands, create_dummy_config_file
10+
from tests.conftest import cli_commands, create_dummy_config_file, tables
1211

1312
from suzieq.restServer.query import (app, get_configured_api_key,
1413
API_KEY_NAME)
15-
from suzieq.sqobjects import get_tables, get_sqobject
14+
from suzieq.sqobjects import get_sqobject
1615
from suzieq.restServer import query
1716

1817
ENDPOINT = "http://localhost:8000/api/v2"
@@ -389,10 +388,10 @@ def get(endpoint, service, verb, args):
389388

390389
@ pytest.mark.rest
391390
@ pytest.mark.parametrize("service", [
392-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
391+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
393392
for cmd in cli_commands])
394393
@pytest.mark.parametrize("verb", [
395-
pytest.param(verb, marks=MarkDecorator(Mark(verb, [], {})))
394+
pytest.param(verb, marks=getattr(pytest.mark, verb))
396395
for verb in VERBS])
397396
@pytest.mark.parametrize("arg", FILTERS)
398397
# pylint: disable=redefined-outer-name, unused-argument
@@ -403,7 +402,7 @@ def test_rest_services(app_initialize, service, verb, arg):
403402

404403
@ pytest.mark.rest
405404
@ pytest.mark.parametrize("service, verb", [
406-
(cmd, verb) for cmd in get_tables() for verb in VERBS])
405+
(cmd, verb) for cmd in tables for verb in VERBS])
407406
def test_rest_arg_consistency(service, verb):
408407
'''check that the arguments used in REST match whats in sqobjects'''
409408

tests/integration/test_schema_read.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import pytest
2-
from _pytest.mark.structures import Mark, MarkDecorator
32

4-
from tests.conftest import DATADIR
5-
from suzieq.sqobjects import get_tables, get_sqobject
3+
from tests.conftest import DATADIR, tables
4+
from suzieq.sqobjects import get_sqobject
65

76

87
@ pytest.mark.schema
98
@ pytest.mark.parametrize('table',
109
[pytest.param(x,
11-
marks=MarkDecorator(Mark(x, [], {})))
12-
for x in get_tables()])
10+
marks=getattr(pytest.mark, x))
11+
for x in tables])
1312
@ pytest.mark.parametrize('datadir', DATADIR)
1413
@pytest.mark.parametrize('columns', [['*'], ['default']])
1514
def test_schema_data_consistency(table, datadir, columns, get_table_data_cols):

tests/integration/test_sqcmds.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
from pathlib import Path
88

99
import pytest
10-
from _pytest.mark.structures import Mark, MarkDecorator
1110

1211
from nubia import context
1312
import pandas as pd
1413

1514
from tests.conftest import (load_up_the_tests, tables, DATADIR,
1615
setup_sqcmds, cli_commands,
1716
create_dummy_config_file)
18-
from suzieq.sqobjects import get_sqobject, get_tables
17+
from suzieq.sqobjects import get_sqobject
1918
from suzieq.cli.sqcmds import * # noqa
2019
from suzieq.version import SUZIEQ_VERSION
2120
from suzieq.shared.utils import get_sq_install_dir
@@ -28,10 +27,10 @@
2827
@pytest.mark.sqcmds
2928
@pytest.mark.slow
3029
@pytest.mark.parametrize("command", [
31-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
30+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
3231
for cmd in cli_commands])
3332
@pytest.mark.parametrize("verb", [
34-
pytest.param(verb, marks=MarkDecorator(Mark(verb, [], {})))
33+
pytest.param(verb, marks=getattr(pytest.mark, verb))
3534
for verb in verbs])
3635
def test_commands(setup_nubia, get_cmd_object_dict, command, verb):
3736
""" runs through all of the commands for each of the sqcmds
@@ -67,7 +66,7 @@ def test_summary_exception(setup_nubia):
6766

6867
@pytest.mark.sqcmds
6968
@pytest.mark.parametrize("cmd", [
70-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
69+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
7170
for cmd in cli_commands])
7271
def test_all_columns(setup_nubia, get_cmd_object_dict, cmd):
7372
s = _test_command(get_cmd_object_dict[cmd], 'show', None,
@@ -78,7 +77,7 @@ def test_all_columns(setup_nubia, get_cmd_object_dict, cmd):
7877
@pytest.mark.sqcmds
7978
@pytest.mark.filter
8079
@pytest.mark.parametrize("cmd", [
81-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
80+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
8281
for cmd in cli_commands])
8382
def test_hostname_show_filter(setup_nubia, get_cmd_object_dict, cmd):
8483
if cmd != "table":
@@ -90,7 +89,7 @@ def test_hostname_show_filter(setup_nubia, get_cmd_object_dict, cmd):
9089
@pytest.mark.sqcmds
9190
@pytest.mark.filter
9291
@pytest.mark.parametrize("cmd", [
93-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
92+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
9493
for cmd in cli_commands])
9594
def test_engine_show_filter(setup_nubia, get_cmd_object_dict, cmd):
9695
s = _test_command(get_cmd_object_dict[cmd], 'show', None,
@@ -101,7 +100,7 @@ def test_engine_show_filter(setup_nubia, get_cmd_object_dict, cmd):
101100
@pytest.mark.sqcmds
102101
@pytest.mark.filter
103102
@pytest.mark.parametrize("cmd", [
104-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
103+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
105104
for cmd in cli_commands])
106105
def test_namespace_show_filter(setup_nubia, get_cmd_object_dict, cmd):
107106
s = _test_command(get_cmd_object_dict[cmd], 'show', None,
@@ -112,7 +111,7 @@ def test_namespace_show_filter(setup_nubia, get_cmd_object_dict, cmd):
112111
@pytest.mark.sqcmds
113112
@pytest.mark.filter
114113
@pytest.mark.parametrize("cmd", [
115-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
114+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
116115
for cmd in cli_commands])
117116
def test_view_show_filter(setup_nubia, get_cmd_object_dict, cmd):
118117
s = _test_command(get_cmd_object_dict[cmd], 'show', None, {'view': 'all'})
@@ -122,7 +121,7 @@ def test_view_show_filter(setup_nubia, get_cmd_object_dict, cmd):
122121
@pytest.mark.sqcmds
123122
@pytest.mark.filter
124123
@pytest.mark.parametrize("cmd", [
125-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
124+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
126125
for cmd in cli_commands])
127126
def test_start_time_show_filter(setup_nubia, get_cmd_object_dict, cmd):
128127
s = _test_command(get_cmd_object_dict[cmd], 'show', None, {
@@ -134,7 +133,7 @@ def test_start_time_show_filter(setup_nubia, get_cmd_object_dict, cmd):
134133
@pytest.mark.filter
135134
@pytest.mark.fast
136135
@pytest.mark.parametrize("cmd", [
137-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
136+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
138137
for cmd in cli_commands])
139138
def test_columns_show_filter(setup_nubia, get_cmd_object_dict, cmd):
140139
if cmd != "table":
@@ -146,7 +145,7 @@ def test_columns_show_filter(setup_nubia, get_cmd_object_dict, cmd):
146145
@pytest.mark.sqcmds
147146
@pytest.mark.filter
148147
@pytest.mark.parametrize("cmd", [
149-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
148+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
150149
for cmd in cli_commands])
151150
def test_bad_show_hostname_filter(setup_nubia, get_cmd_object_dict, cmd):
152151
options = {'hostname': 'unknown'}
@@ -156,7 +155,7 @@ def test_bad_show_hostname_filter(setup_nubia, get_cmd_object_dict, cmd):
156155
@pytest.mark.sqcmds
157156
@pytest.mark.filter
158157
@pytest.mark.parametrize("cmd", [
159-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
158+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
160159
for cmd in cli_commands])
161160
def test_bad_show_engine_filter(setup_nubia, get_cmd_object_dict, cmd):
162161
options = {'engine': 'unknown'}
@@ -166,7 +165,7 @@ def test_bad_show_engine_filter(setup_nubia, get_cmd_object_dict, cmd):
166165
@pytest.mark.sqcmds
167166
@pytest.mark.filter
168167
@pytest.mark.parametrize("cmd", [
169-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
168+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
170169
for cmd in cli_commands])
171170
def test_bad_start_time_filter(setup_nubia, get_cmd_object_dict, cmd):
172171
options = {'start_time': 'unknown'}
@@ -178,7 +177,7 @@ def test_bad_start_time_filter(setup_nubia, get_cmd_object_dict, cmd):
178177
@pytest.mark.sqcmds
179178
@pytest.mark.filter
180179
@pytest.mark.parametrize("cmd", [
181-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
180+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
182181
for cmd in cli_commands])
183182
def test_bad_show_namespace_filter(setup_nubia, get_cmd_object_dict, cmd):
184183
options = {'namespace': 'unknown'}
@@ -214,7 +213,7 @@ def _test_bad_show_filter_w_assert(cmd, options):
214213
@pytest.mark.sqcmds
215214
@pytest.mark.filter
216215
@pytest.mark.parametrize('cmd', [
217-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
216+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
218217
for cmd in cli_commands])
219218
def test_context_filtering(setup_nubia, get_cmd_object_dict, cmd):
220219
for options in good_filters:
@@ -225,7 +224,7 @@ def test_context_filtering(setup_nubia, get_cmd_object_dict, cmd):
225224
@pytest.mark.sqcmds
226225
@pytest.mark.filter
227226
@pytest.mark.parametrize('cmd', [
228-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
227+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
229228
for cmd in cli_commands])
230229
def test_context_namespace_filtering(setup_nubia, get_cmd_object_dict, cmd):
231230
s = _test_context_filtering(get_cmd_object_dict[cmd],
@@ -238,7 +237,7 @@ def test_context_namespace_filtering(setup_nubia, get_cmd_object_dict, cmd):
238237
@pytest.mark.sqcmds
239238
@pytest.mark.filter
240239
@pytest.mark.parametrize('cmd', [
241-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
240+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
242241
for cmd in cli_commands])
243242
def test_context_engine_filtering(setup_nubia, get_cmd_object_dict, cmd):
244243
s = _test_context_filtering(get_cmd_object_dict[cmd], {'engine': 'pandas'})
@@ -248,7 +247,7 @@ def test_context_engine_filtering(setup_nubia, get_cmd_object_dict, cmd):
248247
@pytest.mark.sqcmds
249248
@pytest.mark.fast
250249
@pytest.mark.parametrize('cmd', [
251-
pytest.param(cmd, marks=MarkDecorator(Mark(cmd, [], {})))
250+
pytest.param(cmd, marks=getattr(pytest.mark, cmd))
252251
for cmd in cli_commands])
253252
def test_context_start_time_filtering(setup_nubia, get_cmd_object_dict, cmd):
254253
# before the latest data, so might be more data than the default
@@ -268,8 +267,8 @@ def test_table_describe(setup_nubia, table):
268267
@ pytest.mark.parametrize('table',
269268
[pytest.param(
270269
x,
271-
marks=MarkDecorator(Mark(x, [], {})))
272-
for x in get_tables()
270+
marks=getattr(pytest.mark, x))
271+
for x in tables
273272
if x not in ['path', 'topmem', 'topcpu',
274273
'topmem', 'time', 'ifCounters',
275274
'ospfIf', 'ospfNbr',
@@ -307,8 +306,8 @@ def test_sqcmds_regex_hostname(table, datadir):
307306
@ pytest.mark.parametrize('table',
308307
[pytest.param(
309308
x,
310-
marks=MarkDecorator(Mark(x, [], {})))
311-
for x in get_tables()
309+
marks=getattr(pytest.mark, x))
310+
for x in tables
312311
if x not in ['path', 'inventory']
313312
])
314313
@ pytest.mark.parametrize('datadir', ['tests/data/parquet/'])

tests/unit/poller/controller/sources/native/test_native.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ async def test_invalid_hosts(default_config):
109109
@pytest.mark.poller_unit_tests
110110
@pytest.mark.controller_unit_tests
111111
@pytest.mark.controller_source_native
112-
@pytest.mark.asyncio
113112
def test_validate_inventory(default_config):
114113
"""Check that validate_inventory raise correctly
115114
"""
@@ -129,7 +128,6 @@ def test_validate_inventory(default_config):
129128
@pytest.mark.poller_unit_tests
130129
@pytest.mark.controller_unit_tests
131130
@pytest.mark.controller_source_native
132-
@pytest.mark.asyncio
133131
@pytest.mark.parametrize('address', [
134132
'192.168.0',
135133
'192.168.00.1',

0 commit comments

Comments
 (0)