Skip to content

Commit 8acc4cf

Browse files
authored
Merge pull request #38 from validatedpatterns/refactor_pytest
Refactor pytest
2 parents c8c0f93 + e5d8249 commit 8acc4cf

9 files changed

+264
-1023
lines changed

tests/interop/conftest.py

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,2 @@
1-
import os
2-
3-
import pytest
4-
from kubernetes import config
5-
from kubernetes.client import Configuration
6-
from openshift.dynamic import DynamicClient
7-
8-
from . import __loggername__
9-
from .css_logger import CSS_Logger
10-
11-
12-
def pytest_addoption(parser):
13-
parser.addoption(
14-
"--kubeconfig",
15-
action="store",
16-
default=None,
17-
help="The full path to the kubeconfig file to be used",
18-
)
19-
20-
21-
@pytest.fixture(scope="session")
22-
def get_kubeconfig(request):
23-
if request.config.getoption("--kubeconfig"):
24-
k8config = request.config.getoption("--kubeconfig")
25-
elif "KUBECONFIG" in os.environ.keys() and os.environ["KUBECONFIG"]:
26-
k8config = os.environ["KUBECONFIG"]
27-
else:
28-
raise ValueError(
29-
"A kubeconfig file was not provided. Please provide one either "
30-
"via the --kubeconfig command option or by setting a KUBECONFIG "
31-
"environment variable"
32-
)
33-
return k8config
34-
35-
36-
@pytest.fixture(scope="session")
37-
def kube_config(get_kubeconfig):
38-
kc = Configuration
39-
config.load_kube_config(config_file=get_kubeconfig, client_configuration=kc)
40-
return kc
41-
42-
43-
@pytest.fixture(scope="session")
44-
def openshift_dyn_client(get_kubeconfig):
45-
return DynamicClient(client=config.new_client_from_config(get_kubeconfig))
46-
47-
48-
@pytest.fixture(scope="session", autouse=True)
49-
def setup_logger():
50-
logger = CSS_Logger(__loggername__)
51-
return logger
1+
from validatedpatterns_tests.interop.conftest_logger import * # noqa: F401, F403
2+
from validatedpatterns_tests.interop.conftest_openshift import * # noqa: F401, F403

tests/interop/crd.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

tests/interop/css_logger.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

tests/interop/edge_util.py

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)