Skip to content

Commit 3d9cd6c

Browse files
committed
Add TEST_DIR to VARS
1 parent 027245b commit 3d9cd6c

File tree

5 files changed

+9
-29
lines changed

5 files changed

+9
-29
lines changed

test/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections import namedtuple
22
import os
3+
from pathlib import Path
34
import sys
45

56
from container_ci_suite.utils import check_variables
@@ -16,7 +17,8 @@
1617
IMAGE_NAME=os.getenv("IMAGE_NAME"),
1718
IS_MINIMAL="minimal" in VERSION,
1819
VERSION_NO_MINIMAL=VERSION.replace("-minimal", ""),
19-
SHORT_VERSION=VERSION.replace("-minimal", "").replace(".", "")
20+
SHORT_VERSION=VERSION.replace("-minimal", "").replace(".", ""),
21+
TEST_DIR=Path(__file__).parent.absolute()
2022
)
2123

2224

test/test_helm_python_django_app.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import os
2-
3-
from pathlib import Path
4-
51
from container_ci_suite.helm import HelmChartsAPI
62

73
from constants import TAGS, BRANCH_TO_TEST
84
from conftest import skip_helm_charts_tests, VARS
95

10-
test_dir = Path(os.path.abspath(os.path.dirname(__file__)))
116

127
TAG = TAGS.get(VARS.OS)
138
DEPLOYED_PSQL_IMAGE = "quay.io/sclorg/postgresql-10-c8s:c8s"
@@ -24,8 +19,7 @@ class TestHelmPythonDjangoAppTemplate:
2419

2520
def setup_method(self):
2621
package_name = "redhat-python-django-application"
27-
path = test_dir
28-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
22+
self.hc_api = HelmChartsAPI(path=VARS.TEST_DIR, package_name=package_name, tarball_dir=VARS.TEST_DIR, shared_cluster=True)
2923
self.hc_api.clone_helm_chart_repo(
3024
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
3125
subdir="charts/redhat"

test/test_helm_python_django_psql_persistent.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
import os
2-
3-
from pathlib import Path
4-
51
from container_ci_suite.helm import HelmChartsAPI
62

73
from constants import TAGS, BRANCH_TO_TEST
84
from conftest import skip_helm_charts_tests, VARS
95

10-
test_dir = Path(os.path.abspath(os.path.dirname(__file__)))
11-
126
TAG = TAGS.get(VARS.OS)
137
if VARS.VERSION in ("3.11", "3.12", "3.12-minimal"):
148
BRANCH_TO_TEST = "4.2.x"
@@ -18,8 +12,7 @@ class TestHelmPythonDjangoPsqlTemplate:
1812

1913
def setup_method(self):
2014
package_name = "redhat-django-psql-persistent"
21-
path = test_dir
22-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
15+
self.hc_api = HelmChartsAPI(path=VARS.TEST_DIR, package_name=package_name, tarball_dir=VARS.TEST_DIR, shared_cluster=True)
2316
self.hc_api.clone_helm_chart_repo(
2417
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
2518
subdir="charts/redhat"

test/test_helm_python_imagestreams.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
import os
2-
31
import pytest
4-
from pathlib import Path
52

63
from container_ci_suite.helm import HelmChartsAPI
74

8-
test_dir = Path(os.path.abspath(os.path.dirname(__file__)))
9-
5+
from conftest import VARS
106

117
class TestHelmRHELPythonImageStreams:
128

139
def setup_method(self):
1410
package_name = "redhat-python-imagestreams"
15-
path = test_dir
16-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
11+
self.hc_api = HelmChartsAPI(path=VARS.TEST_DIR, package_name=package_name, tarball_dir=VARS.TEST_DIR, shared_cluster=True)
1712
self.hc_api.clone_helm_chart_repo(
1813
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
1914
subdir="charts/redhat"

test/test_latest_imagestreams.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import os
2-
3-
from pathlib import Path
4-
51
from container_ci_suite.imagestreams import ImageStreamChecker
62

7-
TEST_DIR = Path(os.path.abspath(os.path.dirname(__file__)))
3+
from conftest import VARS
84

95

106
# Replacement with 'test_latest_imagestreams'
117
class TestLatestImagestreams:
128

139
def setup_method(self):
14-
self.isc = ImageStreamChecker(working_dir=TEST_DIR.parent.parent)
10+
self.isc = ImageStreamChecker(working_dir=VARS.TEST_DIR.parent.parent)
1511

1612
def test_latest_imagestream(self):
1713
self.latest_version = self.isc.get_latest_version()

0 commit comments

Comments
 (0)