Blame SOURCES/0007-test_nvmet.py-test_invalid_input-fails-for-py3.patch

26b18e
From 477a04b18e8754dc3f75110f0e7e6cdac70217aa Mon Sep 17 00:00:00 2001
26b18e
From: Tony Asleson <tasleson@redhat.com>
26b18e
Date: Thu, 26 Mar 2020 13:07:49 -0500
26b18e
Subject: [PATCH 07/12] test_nvmet.py: test_invalid_input fails for py3
26b18e
26b18e
When you run 'make test' using python 3 the unit test
26b18e
test_invalid_input fails with:
26b18e
26b18e
Traceback (most recent call last):
26b18e
  File "/someuser/projects/nvmetcli/nvmet/test_nvmet.py", line 395, in
26b18e
test_invalid_input
26b18e
    for i in range(l))
26b18e
  File "/someuser/projects/nvmetcli/nvmet/test_nvmet.py", line 395, in
26b18e
<genexpr>
26b18e
    for i in range(l))
26b18e
AttributeError: module 'string' has no attribute 'lowercase'
26b18e
26b18e
Python 3 does not have 'string.lowercase' ref.
26b18e
https://docs.python.org/3/library/string.html
26b18e
26b18e
Python 2 does ref.
26b18e
https://docs.python.org/2/library/string.html
26b18e
26b18e
Both have "string.ascii_lowercase" so lets leverage that to
26b18e
support both.
26b18e
26b18e
Signed-off-by: Tony Asleson <tasleson@redhat.com>
26b18e
Signed-off-by: Christoph Hellwig <hch@lst.de>
26b18e
---
26b18e
 nvmet/test_nvmet.py | 2 +-
26b18e
 1 file changed, 1 insertion(+), 1 deletion(-)
26b18e
26b18e
diff --git a/nvmet/test_nvmet.py b/nvmet/test_nvmet.py
26b18e
index 5caa546..aae4a86 100644
26b18e
--- a/nvmet/test_nvmet.py
26b18e
+++ b/nvmet/test_nvmet.py
26b18e
@@ -391,7 +391,7 @@ class TestNvmet(unittest.TestCase):
26b18e
                           nqn='/', mode='create')
26b18e
 
26b18e
         for l in [ 257, 512, 1024, 2048 ]:
26b18e
-            toolong = ''.join(random.choice(string.lowercase)
26b18e
+            toolong = ''.join(random.choice(string.ascii_lowercase)
26b18e
                               for i in range(l))
26b18e
             self.assertRaises(nvme.CFSError, nvme.Subsystem,
26b18e
                               nqn=toolong, mode='create')
26b18e
-- 
26b18e
2.29.2
26b18e