This is an automated email from the git hooks/post-receive script.
nsoffer pushed a commit to branch master
in repository sanlock.
commit 040d287eb3b267f06492af3ecc4911a587a4bfa8
Author: Amit Bawer <abawer(a)redhat.com>
AuthorDate: Thu May 16 15:29:51 2019 +0300
tests: Add parameterized tests for file paths encodings
Currently we have two tests expecting to fail, this holds until we add
the path converter funcationality.
- Py2: currenlty not supporing non-ascii paths
- Py3: currently not supporting bytes paths
---
tests/python_test.py | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/tests/python_test.py b/tests/python_test.py
index e721fe8..a24990d 100644
--- a/tests/python_test.py
+++ b/tests/python_test.py
@@ -8,6 +8,7 @@ import io
import struct
import time
+import six
import pytest
import sanlock
@@ -32,14 +33,31 @@ SECTOR_SIZE_512 = 512
SECTOR_SIZE_4K = 4 * KiB
+FILE_NAMES = [
+ #name, encoding
+ ("ascii", None),
+ (u"ascii", None),
+ pytest.param(
+ u"\u05d0", None,
+ marks=pytest.mark.xfail(
+ six.PY2,
+ reason="currently not supporting non-ascii paths")),
+ pytest.param(
+ u"\u05d0", "utf-8",
+ marks=pytest.mark.xfail(
+ six.PY3,
+ reason="currently not supporting bytes paths")),
+]
+
+(a)pytest.mark.parametrize("filename, encoding" , FILE_NAMES)
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(LOCKSPACE_SIZE, 0),
# Large offset.
(LARGE_FILE_SIZE, LARGE_FILE_SIZE - LOCKSPACE_SIZE),
])
-def test_write_lockspace(tmpdir, sanlock_daemon, size, offset):
- path = str(tmpdir.join("lockspace"))
+def test_write_lockspace(tmpdir, sanlock_daemon, filename, encoding, size, offset):
+ path = util.generate_path(tmpdir, filename, encoding)
util.create_file(path, size)
# Test read and write with default alignment and sector size values.
@@ -116,14 +134,15 @@ def test_read_lockspace_4k_invalid_sector_size(sanlock_daemon,
user_4k_path):
assert e.value.errno == errno.EINVAL
+(a)pytest.mark.parametrize("filename,encoding", FILE_NAMES)
@pytest.mark.parametrize("size,offset", [
# Smallest offset.
(MIN_RES_SIZE, 0),
# Large offset.
(LARGE_FILE_SIZE, LARGE_FILE_SIZE - MIN_RES_SIZE),
])
-def test_write_resource(tmpdir, sanlock_daemon, size, offset):
- path = str(tmpdir.join("resources"))
+def test_write_resource(tmpdir, sanlock_daemon, filename, encoding, size, offset):
+ path = util.generate_path(tmpdir, filename, encoding)
util.create_file(path, size)
disks = [(path, offset)]
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.