From: Amit Bawer <abawer@redhat.com>
From this point, all API tests for should PASS or xfail specifically.
Redundant "for". Or need to add something after "for".
Suggestion if I understood you correctly: "specifically" --> "explicitly"
XPASS is only known for python 3 on read invalid 4k sector size test.
---
tests/python_test.py | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/tests/python_test.py b/tests/python_test.py
index 7093aac..926a0f0 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -51,24 +51,21 @@ FILE_NAMES = [
reason="currently not supporting bytes paths")),
]
LOCKSPACE_OR_RESOURCE_NAMES = [
# Bytes are supported with python 2 and 3.
- pytest.param(
- b"\xd7\x90",
- marks=pytest.mark.xfail(six.PY3, reason="bytes support not implemented yet")),
+ pytest.param(b"\xd7\x90"),
# Python 2 also supports str.
pytest.param(
"\xd7\x90",
marks=pytest.mark.skipif(six.PY3, reason="python 3 supports only bytes")),
# Python 2 also supports unicode with ascii content.
pytest.param(
u"ascii",
marks=pytest.mark.skipif(six.PY3, reason="python 3 supports only bytes")),
]
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("filename, encoding" , FILE_NAMES)
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(LOCKSPACE_SIZE, 0),
# Large offset.
@@ -105,11 +102,10 @@ def test_write_lockspace(tmpdir, sanlock_daemon, filename, encoding, size, offse
# TODO: check more stuff here...
util.check_guard(path, size)
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("align", sanlock.ALIGN_SIZE)
def test_write_lockspace_4k(user_4k_path, sanlock_daemon, align):
# Poison lockspace area, ensuring that previous tests will not break this
# test, and sanlock does not write beyond the lockspace area.
@@ -135,11 +131,10 @@ def test_write_lockspace_4k(user_4k_path, sanlock_daemon, align):
# Check that sanlock did not write beyond the lockspace area.
util.check_guard(user_4k_path, align)
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
def test_write_lockspace_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
with pytest.raises(sanlock.SanlockException) as e:
sanlock.write_lockspace(
b"ls_name", user_4k_path, iotimeout=1, sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
@@ -153,11 +148,10 @@ def test_read_lockspace_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
with pytest.raises(sanlock.SanlockException) as e:
sanlock.read_lockspace(user_4k_path, sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("filename,encoding", FILE_NAMES)
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
# Large offset.
@@ -202,11 +196,10 @@ def test_write_resource(tmpdir, sanlock_daemon, filename, encoding, size, offset
# TODO: check more stuff here...
util.check_guard(path, size)
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("align", sanlock.ALIGN_SIZE)
def test_write_resource_4k(sanlock_daemon, user_4k_path, align):
disks = [(user_4k_path, 0)]
# Poison resource area, ensuring that previous tests will not break this
@@ -248,11 +241,10 @@ def test_write_resource_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
sanlock.write_resource(
b"ls_name", b"res_name", disks, sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
def test_read_resource_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
disks = [(user_4k_path, 0)]
sanlock.write_resource(
b"ls_name",
@@ -264,11 +256,10 @@ def test_read_resource_4k_invalid_sector_size(sanlock_daemon, user_4k_path):
with pytest.raises(sanlock.SanlockException) as e:
sanlock.read_resource(user_4k_path, sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
def test_read_resource_owners_4k_invalid_sector_size(
sanlock_daemon, user_4k_path):
disks = [(user_4k_path, 0)]
sanlock.write_resource(
@@ -282,11 +273,10 @@ def test_read_resource_owners_4k_invalid_sector_size(
sanlock.read_resource_owners(
b"ls_name", b"res_name", disks, sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
def test_read_resource_owners_invalid_align_size(tmpdir, sanlock_daemon):
path = str(tmpdir.join("path"))
util.create_file(path, GiB)
disks = [(path, 0)]
@@ -305,11 +295,10 @@ def test_read_resource_owners_invalid_align_size(tmpdir, sanlock_daemon):
align=ALIGNMENT_2M,
sector=SECTOR_SIZE_512)
assert e.value.errno == errno.EINVAL
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
# Large offset.
(LARGE_FILE_SIZE, LARGE_FILE_SIZE - MIN_RES_SIZE),
@@ -350,11 +339,10 @@ def test_add_rem_lockspace(tmpdir, sanlock_daemon, size, offset):
lockspaces = sanlock.get_lockspaces()
assert lockspaces == []
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
def test_add_rem_lockspace_async(tmpdir, sanlock_daemon):
path = str(tmpdir.join("ls_name"))
util.create_file(path, MiB)
sanlock.write_lockspace(b"ls_name", path, iotimeout=1)
@@ -387,11 +375,10 @@ def test_add_rem_lockspace_async(tmpdir, sanlock_daemon):
# Once the lockspace was released, we expect to get False.
acquired = sanlock.inq_lockspace(b"ls_name", 1, path, wait=True)
assert acquired is False
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
# Large offset.
(LARGE_FILE_SIZE, LARGE_FILE_SIZE - MIN_RES_SIZE),
@@ -461,11 +448,10 @@ def test_acquire_release_resource(tmpdir, sanlock_daemon, size, offset):
owners = sanlock.read_resource_owners(b"ls_name", b"res_name", disks)
assert owners == []
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("align, sector", [
# Invalid alignment
(KiB, sanlock.SECTOR_SIZE[0]),
# Invalid sector size
(sanlock.ALIGN_SIZE[0], 8 * KiB),
@@ -477,11 +463,10 @@ def test_write_lockspace_invalid_align_sector(
with pytest.raises(ValueError):
sanlock.write_lockspace(b"ls_name", path, align=align, sector=sector)
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("align, sector", [
# Invalid alignment
(KiB, sanlock.SECTOR_SIZE[0]),
# Invalid sector size
(sanlock.ALIGN_SIZE[0], 8 * KiB),
@@ -495,11 +480,10 @@ def test_write_resource_invalid_align_sector(
with pytest.raises(ValueError):
sanlock.write_resource(
b"ls_name", b"res_name", disks, align=align, sector=sector)
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("disk", [
# Not a tuple - unicode and bytes:
"not a tuple",
b"not a tuple",
u'\u05e9\u05dc\u05d5\u05dd',
@@ -550,31 +534,28 @@ def test_add_lockspace_parse_args(no_sanlock_daemon, name):
def test_write_lockspace_parse_args(no_sanlock_daemon, name):
with raises_sanlock_errno():
sanlock.write_lockspace(name, "ls_path")
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
def test_write_resource_parse_args(no_sanlock_daemon, name):
with raises_sanlock_errno():
sanlock.write_resource(name, b"res_name", [("disk_path",0)])
with raises_sanlock_errno():
sanlock.write_resource(b"ls_name", name, [("disk_path",0)])
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
def test_release_resource_parse_args(no_sanlock_daemon, name):
with raises_sanlock_errno():
sanlock.release(name, b"res_name", [("disk_path",0)])
with raises_sanlock_errno():
sanlock.release(b"ls_name", name, [("disk_path",0)])
-@pytest.mark.xfail(six.PY3, reason="lockspace/resource names in bytes are unsupported yet")
@pytest.mark.parametrize("name", LOCKSPACE_OR_RESOURCE_NAMES)
def test_read_resource_owners_parse_args(no_sanlock_daemon, name):
with raises_sanlock_errno():
sanlock.read_resource_owners(name, b"res_name", [("disk_path",0)])
--
2.17.2