Skip to content

Commit 465f1cd

Browse files
committed
tests: Add --only-rest and --only-xmlrpc options
To limit the 'backends' parameterized tests to use only one method Signed-off-by: Cole Robinson <[email protected]>
1 parent b4602d5 commit 465f1cd

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

tests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class _CLICONFIG(object):
88
def __init__(self):
99
self.REDHAT_URL = None
1010
self.REGENERATE_OUTPUT = False
11+
self.ONLY_REST = False
12+
self.ONLY_XMLRPC = False
1113

1214

1315
CLICONFIG = _CLICONFIG()

tests/conftest.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def pytest_addoption(parser):
3838
parser.addoption("--regenerate-output",
3939
action="store_true", default=False,
4040
help=("Force regeneration of generated test output"))
41+
parser.addoption("--only-rest", action="store_true", default=False)
42+
parser.addoption("--only-xmlrpc", action="store_true", default=False)
4143

4244

4345
def pytest_ignore_collect(path, config):
@@ -72,6 +74,10 @@ def pytest_configure(config):
7274
# Functional tests need access to HOME cached auth.
7375
# Unit tests shouldn't be touching any HOME files
7476
os.environ["HOME"] = os.path.dirname(__file__) + "/data/homedir"
77+
if config.getoption("--only-rest"):
78+
tests.CLICONFIG.ONLY_REST = True
79+
if config.getoption("--only-xmlrpc"):
80+
tests.CLICONFIG.ONLY_XMLRPC = True
7581

7682

7783
def pytest_generate_tests(metafunc):
@@ -80,8 +86,14 @@ def pytest_generate_tests(metafunc):
8086
force_rest=True and force_xmlrpc=True Bugzilla options
8187
"""
8288
if 'backends' in metafunc.fixturenames:
83-
values = [{"force_xmlrpc": True}, {"force_rest": True}]
84-
ids = ["XMLRPC", "REST"]
89+
values = []
90+
ids = []
91+
if not tests.CLICONFIG.ONLY_REST:
92+
values.append({"force_xmlrpc": True})
93+
ids.append("XMLRPC")
94+
if not tests.CLICONFIG.ONLY_XMLRPC:
95+
values.append({"force_rest": True})
96+
ids.append("REST")
8597
metafunc.parametrize("backends", values, ids=ids, scope="session")
8698

8799

0 commit comments

Comments
 (0)