2121PASSWORD = os .environ .get ('UPCLOUD_API_PASSWD' )
2222
2323
24- def pytest_addoption (parser ):
25- parser .addoption (
26- "--integration-tests" , action = "store_true" , default = False , help = "run integration tests"
27- )
28-
29-
30- def pytest_configure (config ):
31- config .addinivalue_line ("markers" , "interagtion: mark test as integration" )
32-
33-
34- def pytest_collection_modifyitems (config , items ):
35- if config .getoption ("--integration-tests" ):
36- # --integration-tests given in cli: do not skip integration tests
37- return
38- integration_tests = pytest .mark .skip (reason = "need --integration-tests option to run" )
39- for item in items :
40- if "integration_test" in item .keywords :
41- item .add_marker (integration_tests )
24+ integration_test = pytest .mark .skipif (
25+ not pytest .config .getoption ('--integration-tests' ),
26+ reason = 'need --integration-tests option to run'
27+ )
4228
4329
4430# globals to store created resources so we can cleanup after tests
@@ -56,7 +42,7 @@ def delete_tag(tag):
5642 tag .destroy ()
5743
5844
59- @pytest . mark . integration_test
45+ @integration_test
6046def teardown_module (module ):
6147 manager = CloudManager (USERNAME , PASSWORD , timeout = 160 )
6248
@@ -75,7 +61,7 @@ def teardown_module(module):
7561 manager .delete_tag (tag )
7662
7763
78- @pytest . mark . integration_test
64+ @integration_test
7965def test_infra_ops ():
8066 global CREATED_SERVERS
8167 global CREATED_TAGS
0 commit comments