Skip to content

Commit 60b42ae

Browse files
committed
tests: Run regular test suite alongside functional tests
This lets us check the whole code coverage more easily Signed-off-by: Cole Robinson <crobinso@redhat.com>
1 parent af77a3e commit 60b42ae

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

tests/conftest.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@ def pytest_addoption(parser):
4141
def pytest_ignore_collect(path, config):
4242
has_ro = config.getoption("--ro-functional")
4343
has_rw = config.getoption("--rw-functional")
44-
skip_rest = has_ro or has_rw
4544

4645
base = os.path.basename(str(path))
4746
is_ro = base == "test_ro_functional.py"
4847
is_rw = base == "test_rw_functional.py"
49-
if is_ro or is_rw:
50-
if is_ro and not has_ro:
51-
return True
52-
if is_rw and not has_rw:
53-
return True
54-
elif skip_rest:
55-
config.option.verbose = 2
48+
if is_ro and not has_ro:
49+
return True
50+
if is_rw and not has_rw:
5651
return True
5752

5853

@@ -72,16 +67,15 @@ def pytest_configure(config):
7267
if config.getoption("--regenerate-output"):
7368
tests.CLICONFIG.REGENERATE_OUTPUT = config.getoption(
7469
"--regenerate-output")
75-
if not (config.getoption("--ro-functional") or
76-
config.getoption("--rw-functional")):
77-
# Functional tests need access to HOME cached auth.
78-
# Unit tests shouldn't be touching any HOME files
79-
os.environ["HOME"] = os.path.dirname(__file__) + "/data/homedir"
8070
if config.getoption("--only-rest"):
8171
tests.CLICONFIG.ONLY_REST = True
8272
if config.getoption("--only-xmlrpc"):
8373
tests.CLICONFIG.ONLY_XMLRPC = True
8474

75+
if (config.getoption("--ro-functional") or
76+
config.getoption("--rw-functional")):
77+
config.option.verbose = 2
78+
8579

8680
def pytest_generate_tests(metafunc):
8781
"""

tests/test_api_authfiles.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
import tests.utils
2424

2525

26-
def testCookies():
26+
def testCookies(monkeypatch):
27+
monkeypatch.setitem(os.environ, "HOME",
28+
os.path.dirname(__file__) + "/data/homedir")
29+
2730
dirname = os.path.dirname(__file__)
2831
cookiesbad = dirname + "/data/cookies-bad.txt"
2932
cookieslwp = dirname + "/data/cookies-lwp.txt"

0 commit comments

Comments
 (0)