77from pathlib import Path
88
99import pytest
10- from _pytest .mark .structures import Mark , MarkDecorator
1110
1211from nubia import context
1312import pandas as pd
1413
1514from 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
1918from suzieq .cli .sqcmds import * # noqa
2019from suzieq .version import SUZIEQ_VERSION
2120from suzieq .shared .utils import get_sq_install_dir
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 ])
3635def 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 ])
7271def 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 ])
8382def 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 ])
9594def 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 ])
106105def 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 ])
117116def 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 ])
127126def 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 ])
139138def 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 ])
151150def 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 ])
161160def 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 ])
171170def 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 ])
183182def 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 ])
219218def 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 ])
230229def 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 ])
243242def 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 ])
253252def 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/' ])
0 commit comments