BIND 10 master, updated. 6f344e77217625e36e924f41c24d88ac0ba685be Merge #2937

BIND 10 source code commits bind10-changes at lists.isc.org
Tue May 21 08:07:32 UTC 2013


The branch, master has been updated
       via  6f344e77217625e36e924f41c24d88ac0ba685be (commit)
       via  c8d00f7c62ecf19879d70e6dcfdc0ab14551b6c9 (commit)
       via  76b4abce83b333c61b596df651dfc2f9e3d72100 (commit)
       via  72fca133ddc102924bef14d4281314309fb51201 (commit)
       via  4bc06a779cbe53dd5ad91ef4fe0c0262e430f03e (commit)
      from  2500db669d6463c3ee2f607be63ac0690cf7205e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6f344e77217625e36e924f41c24d88ac0ba685be
Merge: 2500db6 c8d00f7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue May 21 09:07:29 2013 +0200

    Merge #2937
    
    Fix CSV-related test for usermanager that failed on some versions of
    python (seen on 3.2.4 on Gentoo).

-----------------------------------------------------------------------

Summary of changes:
 src/bin/usermgr/b10-cmdctl-usermgr.py.in         |    2 +-
 src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py |   21 ++++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/usermgr/b10-cmdctl-usermgr.py.in b/src/bin/usermgr/b10-cmdctl-usermgr.py.in
index 37be304..b0fd30f 100755
--- a/src/bin/usermgr/b10-cmdctl-usermgr.py.in
+++ b/src/bin/usermgr/b10-cmdctl-usermgr.py.in
@@ -75,7 +75,7 @@ class UserManager:
             # Just let any file read error bubble up; it will
             # be caught in the run() method
             with open(self.options.output_file, newline='') as csvfile:
-                reader = csv.reader(csvfile)
+                reader = csv.reader(csvfile, strict=True)
                 for row in reader:
                     self.user_info[row[0]] = row
 
diff --git a/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py b/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
index 3d0d4af..0766b7c 100644
--- a/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
+++ b/src/bin/usermgr/tests/b10-cmdctl-usermgr_test.py
@@ -133,6 +133,8 @@ class TestUserMgr(unittest.TestCase):
                          May be None, in which case the check is skipped.
         expected_stderr, (multiline) string that is checked against stderr.
                          May be None, in which case the check is skipped.
+
+        Returns the standard output and error captured to a string.
         """
         (returncode, stdout, stderr) = run(command)
         if expected_stderr is not None:
@@ -140,6 +142,7 @@ class TestUserMgr(unittest.TestCase):
         if expected_stdout is not None:
             self.assertEqual(expected_stdout, stdout.decode())
         self.assertEqual(expected_returncode, returncode, " ".join(command))
+        return (stdout.decode(), stderr.decode())
 
     def test_help(self):
         self.run_check(0,
@@ -468,14 +471,26 @@ Options:
         # I can only think of one invalid format, an unclosed string
         with open(self.OUTPUT_FILE, 'w', newline='') as f:
             f.write('a,"\n')
-        self.run_check(2,
-                       'Using accounts file: test_users.csv\n'
-                       'Error parsing csv file: newline inside string\n',
+        # Different versions of the csv library return different errors.
+        # So we need to check the output in a little more complex way.
+        # We ask the run_check not to check the output and check it
+        # ourselves.
+        (stdout, stderr) = self.run_check(2, None,
                        '',
                        [ self.TOOL,
                          '-f', self.OUTPUT_FILE,
                          'add', 'user1', 'pass1'
                        ])
+        # This looks little bit awkward, but is probably easiest with
+        # just 2 known possibilities. If there are more, we'll have to
+        # think of something else.
+        self.assertTrue(stdout ==
+                        'Using accounts file: test_users.csv\n'
+                        'Error parsing csv file: newline inside string\n' or
+                        stdout ==
+                        'Using accounts file: test_users.csv\n'
+                        'Error parsing csv file: unexpected end of data\n')
+
 
 
 if __name__== '__main__':



More information about the bind10-changes mailing list