@@ -39,7 +39,9 @@ class GlobalData:
3939 cluster : bool = None
4040 complete : bool = None
4141 replication : bool = None
42- enterprise : bool = None
42+ skip : list [str ] = None
43+ foxx_path : str = None
44+ backup_path : str = None
4345 secret : str = None
4446 root_password : str = None
4547 db_version : version = version .parse ("0.0.0" )
@@ -49,24 +51,70 @@ class GlobalData:
4951
5052
5153def pytest_addoption (parser ):
52- parser .addoption ("--host" , action = "store" , default = "127.0.0.1" )
53- parser .addoption ("--port" , action = "append" , default = None )
54- parser .addoption ("--passwd" , action = "store" , default = "passwd" )
55- parser .addoption ("--complete" , action = "store_true" )
56- parser .addoption ("--cluster" , action = "store_true" )
57- parser .addoption ("--replication" , action = "store_true" )
58- parser .addoption ("--enterprise" , action = "store_true" )
59- parser .addoption ("--secret" , action = "store" , default = "secret" )
54+ parser .addoption (
55+ "--host" , action = "store" , default = "127.0.0.1" , help = "ArangoDB host address"
56+ )
57+ parser .addoption (
58+ "--port" , action = "append" , default = None , help = "ArangoDB coordinator ports"
59+ )
60+ parser .addoption (
61+ "--root" , action = "store" , default = "root" , help = "ArangoDB root user"
62+ )
63+ parser .addoption (
64+ "--password" , action = "store" , default = "passwd" , help = "ArangoDB password"
65+ )
66+ parser .addoption (
67+ "--secret" , action = "store" , default = "secret" , help = "ArangoDB JWT secret"
68+ )
69+ parser .addoption (
70+ "--cluster" , action = "store_true" , help = "Run tests in a cluster setup"
71+ )
72+ parser .addoption (
73+ "--complete" ,
74+ action = "store_true" ,
75+ help = "Run extra async and transaction tests (not supported)" ,
76+ )
77+ parser .addoption ("--replication" , action = "store_true" , help = "Run replication tests" )
78+ parser .addoption (
79+ "--foxx-path" ,
80+ action = "store" ,
81+ default = "/tests/static/service.zip" ,
82+ help = "Foxx tests service path" ,
83+ )
84+ parser .addoption (
85+ "--backup-path" ,
86+ action = "store" ,
87+ default = "local://tmp" ,
88+ help = "Backup tests repository path" ,
89+ )
90+ parser .addoption (
91+ "--skip" ,
92+ action = "store" ,
93+ nargs = "*" ,
94+ choices = [
95+ "backup" , # backup tests
96+ "batch" , # batch API tests (deprecated)
97+ "jwt-secret-keyfile" , # server was not configured with a keyfile
98+ "foxx" , # foxx is not supported
99+ "js-transactions" , # javascript transactions are not supported
100+ "task" , # tasks API
101+ "enterprise" , # skip what used to be "enterprise-only" before 3.12
102+ ],
103+ default = [],
104+ help = "Skip specific tests" ,
105+ )
60106
61107
62108def pytest_configure (config ):
63109 ports = config .getoption ("port" )
64110 if ports is None :
65111 ports = ["8529" ]
66- hosts = [f"http://{ config .getoption ('host' )} :{ p } " for p in ports ]
112+ hosts = [f"http://{ config .getoption ('host' )} :{ p } " for p in ports ] # noqa: E231
67113 url = hosts [0 ]
68114 secret = config .getoption ("secret" )
69115 cluster = config .getoption ("cluster" )
116+ root_password = config .getoption ("password" )
117+ root_user = config .getoption ("root" )
70118
71119 host_resolver = "fallback"
72120 http_client = DefaultHTTPClient (request_timeout = 120 )
@@ -76,8 +124,8 @@ def pytest_configure(config):
76124 )
77125 sys_db = client .db (
78126 name = "_system" ,
79- username = "root" ,
80- password = config . getoption ( "passwd" ) ,
127+ username = root_user ,
128+ password = root_password ,
81129 superuser_token = generate_jwt (secret ),
82130 verify = True ,
83131 )
@@ -148,9 +196,11 @@ def pytest_configure(config):
148196 global_data .cluster = cluster
149197 global_data .complete = config .getoption ("complete" )
150198 global_data .replication = config .getoption ("replication" )
151- global_data .enterprise = config .getoption ("enterprise" )
152199 global_data .secret = secret
153- global_data .root_password = config .getoption ("passwd" )
200+ global_data .root_password = root_password
201+ global_data .skip = config .getoption ("skip" )
202+ global_data .backup_path = config .getoption ("backup_path" )
203+ global_data .foxx_path = config .getoption ("foxx_path" )
154204
155205
156206# noinspection PyShadowingNames
@@ -186,7 +236,7 @@ def pytest_unconfigure(*_): # pragma: no cover
186236 sys_db .delete_collection (col_name , ignore_missing = True )
187237
188238 # # Remove all backups.
189- if global_data .enterprise :
239+ if "backup" not in global_data .skip and " enterprise" not in global_data . skip :
190240 for backup_id in sys_db .backup .get ()["list" ].keys ():
191241 sys_db .backup .delete (backup_id )
192242
@@ -223,16 +273,6 @@ def pytest_generate_tests(metafunc):
223273 bad_async_db ._executor = TestAsyncApiExecutor (bad_conn )
224274 bad_dbs .append (bad_async_db )
225275
226- # Skip test batch databases, as they are deprecated.
227- """
228- tst_batch_db = StandardDatabase(tst_conn)
229- tst_batch_db._executor = TestBatchExecutor(tst_conn)
230- tst_dbs.append(tst_batch_db)
231- bad_batch_bdb = StandardDatabase(bad_conn)
232- bad_batch_bdb._executor = TestBatchExecutor(bad_conn)
233- bad_dbs.append(bad_batch_bdb)
234- """
235-
236276 if "db" in metafunc .fixturenames and "bad_db" in metafunc .fixturenames :
237277 metafunc .parametrize ("db,bad_db" , zip (tst_dbs , bad_dbs ))
238278
@@ -431,11 +471,21 @@ def replication():
431471 return global_data .replication
432472
433473
434- @pytest .fixture (autouse = False )
435- def enterprise ():
436- return global_data .enterprise
437-
438-
439474@pytest .fixture (autouse = False )
440475def secret ():
441476 return global_data .secret
477+
478+
479+ @pytest .fixture
480+ def backup_path ():
481+ return global_data .backup_path
482+
483+
484+ @pytest .fixture
485+ def foxx_path ():
486+ return global_data .foxx_path
487+
488+
489+ @pytest .fixture
490+ def skip_tests ():
491+ return global_data .skip
0 commit comments