Skip to content

Commit 93434bc

Browse files
test: Ensure pytest-timeout is available and skip qemu_nb_test on centos
- Skip test_block_device on CentOS due to the use pwrite_zeroes_alignment patch not being included on qemu-img, see https://gitlab.com/qemu-project/qemu/-/commit/d704a13d2c025779bc91d04e127427347ddcf3b3 for more information. - Ensure pytest-timeout is available during bench to avoid possible dependency errors. Signed-off-by: Jasper Berton <jasper.berton@team.blue>
1 parent 9b0d1a3 commit 93434bc

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

test/qemu_nbd_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ def test_block_signals(tmpdir):
482482
assert s.wait(0.2) is not None
483483

484484

485+
@pytest.mark.skipif(
486+
testutil.is_centos_9_or_10,
487+
reason="Skip until patch for qemu-img due to using pwrite_zeroes_alignment when writing first sector is also in CentOS.",
488+
)
485489
@pytest.mark.parametrize("fmt", ["raw", "qcow2"])
486490
def test_block_device(tmpdir, user_block, fmt):
487491
qemu_img.create(user_block.path, fmt, size=1024**3)

test/testutil.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,12 @@ def ipv6_enabled():
6868
out = subprocess.check_output(["ip", "-6", "-j", "addr"])
6969
addresses = json.loads(out)
7070
return len(addresses) > 0
71+
72+
73+
def is_centos_9_or_10():
74+
try:
75+
with open("/etc/os-release") as f:
76+
content = f.read()
77+
return ("ID=\"centos\"" in content or "ID=centos" in content)
78+
except OSError:
79+
return False

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ deps =
1919
test,bench: pytest
2020
test,bench: userstorage>=0.5.3
2121
test,bench: setuptools>=68.2.2
22+
test,bench: pytest-timeout
2223
test: pytest-cov
23-
test: pytest-timeout
2424
commands_pre =
2525
# Since Python 3.12, setuptools is not installed by default.
2626
pip install setuptools>=68.2.2

0 commit comments

Comments
 (0)