Skip to content

Commit 2445ada

Browse files
authored
Merge pull request #1046 from SUSE/python-micro-fix
Fix no tests ran for python-micro
2 parents 0f61470 + 75f19da commit 2445ada

3 files changed

Lines changed: 37 additions & 15 deletions

File tree

bci_tester/data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,7 @@ def create_BCI(
14591459
MICRO_FIPS_CONTAINER,
14601460
MINIMAL_CONTAINER,
14611461
*NGINX_CONTAINERS,
1462+
*PYTHON_MICRO_CONTAINERS,
14621463
*POSTFIX_CONTAINERS,
14631464
*TOMCAT_CONTAINERS,
14641465
*POSTGRESQL_CONTAINERS,
@@ -1536,6 +1537,7 @@ def create_BCI(
15361537
+ OPENJDK_DEVEL_CONTAINERS
15371538
+ PCP_CONTAINERS
15381539
+ PYTHON_CONTAINERS
1540+
+ PYTHON_MICRO_CONTAINERS
15391541
+ RMT_CONTAINERS
15401542
+ RUBY_CONTAINERS
15411543
+ RUST_CONTAINERS

tests/test_metadata.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
from bci_tester.data import POSTGRESQL_CONTAINERS
9393
from bci_tester.data import PROMETHEUS_CONTAINERS
9494
from bci_tester.data import PYTHON_CONTAINERS
95+
from bci_tester.data import PYTHON_MICRO_CONTAINERS
9596
from bci_tester.data import RELEASED_LTSS_VERSIONS
9697
from bci_tester.data import RMT_CONTAINERS
9798
from bci_tester.data import RUBY_CONTAINERS
@@ -211,7 +212,10 @@ def _get_container_ref(
211212
for c in KIOSK_XORG_CLIENT_CONTAINERS
212213
]
213214
+ [(c, "nodejs", ImageType.LANGUAGE_STACK) for c in NODEJS_CONTAINERS]
214-
+ [(c, "python", ImageType.LANGUAGE_STACK) for c in PYTHON_CONTAINERS]
215+
+ [
216+
(c, "python", ImageType.LANGUAGE_STACK)
217+
for c in PYTHON_CONTAINERS + PYTHON_MICRO_CONTAINERS
218+
]
215219
+ [(c, "ruby", ImageType.LANGUAGE_STACK) for c in RUBY_CONTAINERS]
216220
+ [(c, "base-fips", ImageType.OS) for c in BASE_FIPS_CONTAINERS]
217221
+ [

tests/test_python.py

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from bci_tester.data import OS_VERSION
1818
from bci_tester.data import PYTHON_CONTAINERS
19+
from bci_tester.data import PYTHON_MICRO_CONTAINERS
1920
from bci_tester.data import PYTHON_WITH_PIPX_CONTAINERS
2021
from bci_tester.runtime_choice import PODMAN_SELECTED
2122

@@ -28,7 +29,7 @@
2829

2930

3031
#: Base containers under test, input of auto_container fixture
31-
CONTAINER_IMAGES = PYTHON_CONTAINERS
32+
CONTAINER_IMAGES = PYTHON_CONTAINERS + PYTHON_MICRO_CONTAINERS
3233

3334

3435
#: Derived containers with the python http.server as CMD and a HEALTHCHECK
@@ -47,7 +48,7 @@
4748
marks=CONTAINER_T.marks,
4849
id=CONTAINER_T.id,
4950
)
50-
for CONTAINER_T in CONTAINER_IMAGES
51+
for CONTAINER_T in PYTHON_CONTAINERS
5152
]
5253

5354
REQUESTS_CONTAINER_IMAGES = [
@@ -197,11 +198,16 @@ def test_tox(auto_container_per_test):
197198

198199

199200
@pytest.mark.skipif(
200-
OS_VERSION == "16.0", reason="no packaged tox version available"
201+
OS_VERSION in ["16.0", "16.1"], reason="no packaged tox version available"
202+
)
203+
@pytest.mark.parametrize(
204+
"container_per_test",
205+
PYTHON_CONTAINERS,
206+
indirect=["container_per_test"],
201207
)
202-
def test_packaged_tox(auto_container_per_test):
208+
def test_packaged_tox(container_per_test):
203209
"""Ensure we can use the packaged tox version."""
204-
version = auto_container_per_test.connection.check_output(
210+
version = container_per_test.connection.check_output(
205211
"echo $PYTHON_VERSION"
206212
)
207213
if (
@@ -211,14 +217,19 @@ def test_packaged_tox(auto_container_per_test):
211217
):
212218
pytest.skip("packaged tox not available")
213219

214-
auto_container_per_test.connection.check_output(
220+
container_per_test.connection.check_output(
215221
f"zypper --non-interactive in {'python311' if version.startswith('3.11') else 'python3'}-tox && tox --version"
216222
)
217223

218224

219-
def test_pep517_wheels(auto_container_per_test):
225+
@pytest.mark.parametrize(
226+
"container_per_test",
227+
PYTHON_CONTAINERS,
228+
indirect=["container_per_test"],
229+
)
230+
def test_pep517_wheels(container_per_test):
220231
"""Ensure we can use :command:`pip` to build PEP517 binary wheels"""
221-
version = auto_container_per_test.connection.check_output(
232+
version = container_per_test.connection.check_output(
222233
"echo $PYTHON_VERSION"
223234
)
224235
if "3.12" in version and OS_VERSION not in ("tumbleweed",):
@@ -232,7 +243,7 @@ def test_pep517_wheels(auto_container_per_test):
232243
if OS_VERSION in ("tumbleweed",):
233244
pip_install += " --break-system-packages --user"
234245
ujson_version = "5.10.0"
235-
auto_container_per_test.connection.check_output(
246+
container_per_test.connection.check_output(
236247
"zypper -n install gcc-c++ && "
237248
f"pip download --no-deps --no-binary :all: ujson=={ujson_version} && "
238249
f"tar --no-same-permissions --no-same-owner -xf ujson-{ujson_version}.tar.gz && "
@@ -248,31 +259,36 @@ def test_pep517_wheels(auto_container_per_test):
248259
OS_VERSION == "tumbleweed",
249260
reason="pip --user not working due to PEP 668",
250261
)
251-
def test_pip_install_source_cryptography(auto_container_per_test):
262+
@pytest.mark.parametrize(
263+
"container_per_test",
264+
PYTHON_CONTAINERS,
265+
indirect=["container_per_test"],
266+
)
267+
def test_pip_install_source_cryptography(container_per_test):
252268
"""Check that cryptography python module can be installed from source so that
253269
it is built against the SLE BCI FIPS enabled libopenssl."""
254-
version = auto_container_per_test.connection.check_output(
270+
version = container_per_test.connection.check_output(
255271
"echo $PYTHON_VERSION"
256272
)
257273

258274
if packaging.version.Version(version) < packaging.version.Version("3.10"):
259275
pytest.skip("cryptography tests only supported on >= 3.10")
260276

261277
# install dependencies
262-
auto_container_per_test.connection.run_expect(
278+
container_per_test.connection.run_expect(
263279
[0],
264280
"zypper --non-interactive in cargo libffi-devel openssl-devel gcc tar gzip",
265281
)
266282

267283
# pin cryptography to a version that works with SLE BCI
268284
cryptography_version = "37.0.4"
269-
auto_container_per_test.connection.run_expect(
285+
container_per_test.connection.run_expect(
270286
[0],
271287
f"pip install --no-binary :all: cryptography=={cryptography_version}",
272288
)
273289

274290
# test cryptography
275-
auto_container_per_test.connection.run_expect(
291+
container_per_test.connection.run_expect(
276292
[0],
277293
f"""pip install cryptography-vectors=={cryptography_version} pytest &&
278294
pip download --no-binary :all: cryptography=={cryptography_version} &&

0 commit comments

Comments
 (0)