Skip to content

Commit 4643c8d

Browse files
committed
Add settings.py that gets environment variables
like IMAGE_NAME, OS, VERSION and import them in PyTest suite Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent ba7a7d1 commit 4643c8d

File tree

5 files changed

+15
-25
lines changed

5 files changed

+15
-25
lines changed

2.4-micro/test/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/settings.py

2.4/test/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/settings.py

test/settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import os
2+
3+
from pathlib import Path
4+
5+
6+
VERSION = os.getenv("VERSION")
7+
OS = os.getenv("OS").lower()
8+
IMAGE_NAME = os.getenv("IMAGE_NAME")
9+
TEST_DIR = Path(__file__).parent.absolute()

test/test_container_httpd.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
import os
2-
import sys
31
import re
42
import tempfile
53

6-
from pathlib import Path
7-
84
import pytest
95

106
from container_ci_suite.container_lib import ContainerTestLib
11-
from container_ci_suite.utils import ContainerTestLibUtils, check_variables
12-
13-
14-
if not check_variables():
15-
sys.exit(1)
16-
7+
from container_ci_suite.utils import ContainerTestLibUtils
178

18-
TEST_DIR = Path(__file__).parent.absolute()
19-
VERSION = os.getenv("VERSION")
20-
OS = os.getenv("OS").lower()
21-
IMAGE_NAME = os.getenv("IMAGE_NAME")
9+
from settings import IMAGE_NAME, TEST_DIR
2210

2311

2412
class TestHttpdAppContainer:

test/test_container_httpd_s2i.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
import os
2-
import sys
31
import time
42
import tempfile
53

64
from pathlib import Path
75

86
from container_ci_suite.container_lib import ContainerTestLib
9-
from container_ci_suite.utils import ContainerTestLibUtils, check_variables
7+
from container_ci_suite.utils import ContainerTestLibUtils
108
from container_ci_suite.engines.podman_wrapper import PodmanCLIWrapper
119

12-
if not check_variables():
13-
sys.exit(1)
14-
15-
TEST_DIR = Path(__file__).parent.absolute()
16-
VERSION = os.getenv("VERSION")
17-
OS = os.getenv("OS").lower()
18-
IMAGE_NAME = os.getenv("IMAGE_NAME")
19-
10+
from settings import IMAGE_NAME, TEST_DIR
2011

2112
pre_init_test_app = TEST_DIR / "pre-init-test-app"
2213
sample_test_app = TEST_DIR / "sample-test-app"

0 commit comments

Comments
 (0)