[Python-modules-commits] [dbf] 04/05: merge patched into master

Sandro Tosi morph at moszumanska.debian.org
Wed Nov 4 20:48:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository dbf.

commit cba97f814fa906b36dd764275fe6923ec044b3e7
Merge: 4c0b5dc f4b386e
Author: Sandro Tosi <morph at debian.org>
Date:   Wed Nov 4 20:31:00 2015 +0000

    merge patched into master

 PKG-INFO                                           |  4 +-
 dbf/__init__.py                                    |  2 +-
 dbf/tests.py                                       | 83 ++++++++++++++++++---
 dbf/ver_2.py                                       | 53 +++++---------
 dbf/ver_32.py                                      | 67 +++++++----------
 dbf/ver_33.py                                      | 67 ++++++-----------
 debian/.git-dpm                                    |  6 +-
 ...x-tests-so-that-they-don-t-require-a-main.patch | 85 +++++++++++-----------
 setup.py                                           |  4 +-
 9 files changed, 189 insertions(+), 182 deletions(-)

diff --cc debian/.git-dpm
index 433dc86,0000000..a684c14
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
 +# see git-dpm(1) from git-dpm package
- 904cc9ad7c0dcc9f2f10a8d7a0099a2b0297059f
- 904cc9ad7c0dcc9f2f10a8d7a0099a2b0297059f
- 25ba7216958f33c10b5927c7aa9cbc9829d1c330
++f4b386ea7919f47aab2fc73ddda086c01de894da
++f4b386ea7919f47aab2fc73ddda086c01de894da
++dd802aed0f32291054fa1b43d99b7cdf42538c6e
 +dd802aed0f32291054fa1b43d99b7cdf42538c6e
 +dbf_0.96.005.orig.tar.gz
 +bee65beb1e671b786a0277e67f11368eb4197da4
 +183959
 +debianTag="debian/%e%v"
 +patchedTag="patched/%e%v"
 +upstreamTag="upstream/%e%u"
diff --cc debian/patches/0001-fix-tests-so-that-they-don-t-require-a-main.patch
index e0f880c,0000000..d151e7f
mode 100644,000000..100644
--- a/debian/patches/0001-fix-tests-so-that-they-don-t-require-a-main.patch
+++ b/debian/patches/0001-fix-tests-so-that-they-don-t-require-a-main.patch
@@@ -1,507 -1,0 +1,504 @@@
- From 904cc9ad7c0dcc9f2f10a8d7a0099a2b0297059f Mon Sep 17 00:00:00 2001
++From f4b386ea7919f47aab2fc73ddda086c01de894da Mon Sep 17 00:00:00 2001
 +From: Margarita Manterola <marga at debian.org>
 +Date: Wed, 4 Nov 2015 01:38:17 +0000
 +Subject: fix tests so that they don't require a main.
 +
 +Forwarded: not-yet
 +Last-Update: 2015-06-07
 +---
-  dbf/tests.py | 144 +++++++++++++++++++++++++++++++++--------------------------
-  1 file changed, 80 insertions(+), 64 deletions(-)
++ dbf/tests.py | 141 +++++++++++++++++++++++++++++++++--------------------------
++ 1 file changed, 80 insertions(+), 61 deletions(-)
 +
 +diff --git a/dbf/tests.py b/dbf/tests.py
- index 1632925..9532823 100644
++index 1981b9a..e0d3cc7 100644
 +--- a/dbf/tests.py
 ++++ b/dbf/tests.py
- @@ -2508,6 +2508,12 @@ class TestQuantum(unittest.TestCase):
++@@ -2512,6 +2512,12 @@ class TestQuantum(unittest.TestCase):
 +         self.assertEqual(-none is none, True)
 + 
 + class TestExceptions(unittest.TestCase):
 ++    def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 ++
 ++    def tearDown(self):
 ++        shutil.rmtree(self.tempdir, True)
 ++
 +     def test_bad_field_specs_on_creation(self):
 +         self.assertRaises(FieldSpecError, Table, 'blah', 'age N(3,2)', on_disk=False)
 +         self.assertRaises(FieldSpecError, Table, 'blah', 'name C(300)', on_disk=False)
- @@ -2579,8 +2585,8 @@ class TestExceptions(unittest.TestCase):
++@@ -2583,8 +2589,8 @@ class TestExceptions(unittest.TestCase):
 +         table.open(mode=dbf.READ_ONLY)
 +         self.assertRaises(DbfError, table.append, dict(name='uh uh!'))
 +     def test_clipper(self):
 +-        table = Table(os.path.join(tempdir, 'temptable'), 'name C(377); thesis C(20179)', dbf_type='clp')
 +-        self.assertRaises(BadDataError, Table, os.path.join(tempdir, 'temptable'))
 ++        table = Table(os.path.join(self.tempdir, 'temptable'), 'name C(377); thesis C(20179)', dbf_type='clp')
 ++        self.assertRaises(BadDataError, Table, os.path.join(self.tempdir, 'temptable'))
 + 
 + class TestIndexLocation(unittest.TestCase):
 +     def test_false(self):
- @@ -2591,6 +2597,12 @@ class TestIndexLocation(unittest.TestCase):
++@@ -2595,6 +2601,12 @@ class TestIndexLocation(unittest.TestCase):
 +         self.assertTrue(IndexLocation(42, True))
 + 
 + class TestDbfCreation(unittest.TestCase):
 ++    def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 ++
 ++    def tearDown(self):
 ++        shutil.rmtree(self.tempdir, True)
 ++
 +     "Testing table creation..."
 +     def test_db3_memory_tables(self):
 +         "dbf tables in memory"
- @@ -2606,8 +2618,8 @@ class TestDbfCreation(unittest.TestCase):
-          fields = ['name C(25)', 'hiredate D', 'male L', 'wisdom M', 'qty N(3,0)']
++@@ -2610,8 +2622,8 @@ class TestDbfCreation(unittest.TestCase):
++         fields = ['name C(25)', 'hiredate D', 'male L', 'wisdom M', 'qty N(3,0)', 'weight F(7,3)']
 +         for i in range(1, len(fields)+1):
 +             for fieldlist in combinate(fields, i):
 +-                table = Table(os.path.join(tempdir, 'temptable'), ';'.join(fieldlist), dbf_type='db3')
 +-                table = Table(os.path.join(tempdir, 'temptable'), dbf_type='db3')
 ++                table = Table(os.path.join(self.tempdir, 'temptable'), ';'.join(fieldlist), dbf_type='db3')
 ++                table = Table(os.path.join(self.tempdir, 'temptable'), dbf_type='db3')
 +                 actualFields = table.structure()
 +                 self.assertEqual(fieldlist, actualFields)
 +                 table = open(table.filename, 'rb')
- @@ -2627,13 +2639,13 @@ class TestDbfCreation(unittest.TestCase):
++@@ -2631,13 +2643,13 @@ class TestDbfCreation(unittest.TestCase):
 +                 self.assertTrue(all([type(x) is unicode for x in table.field_names]))
 +     def test_clp_disk_tables(self):
 +         "clp table on disk"
 +-        table = Table(os.path.join(tempdir, 'temptable'), 'name C(377); thesis C(20179)', dbf_type='clp')
 ++        table = Table(os.path.join(self.tempdir, 'temptable'), 'name C(377); thesis C(20179)', dbf_type='clp')
 +         self.assertEqual(table.record_length, 20557)
-          fields = ['name C(10977)', 'hiredate D', 'male L', 'wisdom M', 'qty N(3,0)']
++         fields = ['name C(10977)', 'hiredate D', 'male L', 'wisdom M', 'qty N(3,0)', 'weight F(7,3)']
 +         for i in range(1, len(fields)+1):
 +             for fieldlist in combinate(fields, i):
 +-                table = Table(os.path.join(tempdir, 'temptable'), ';'.join(fieldlist), dbf_type='clp')
 +-                table = Table(os.path.join(tempdir, 'temptable'), dbf_type='clp')
 ++                table = Table(os.path.join(self.tempdir, 'temptable'), ';'.join(fieldlist), dbf_type='clp')
 ++                table = Table(os.path.join(self.tempdir, 'temptable'), dbf_type='clp')
 +                 actualFields = table.structure()
 +                 self.assertEqual(fieldlist, actualFields)
 +                 table = open(table.filename, 'rb')
- @@ -2657,8 +2669,8 @@ class TestDbfCreation(unittest.TestCase):
-                    'litres F(11,5)', 'blob G', 'graphic P']
++@@ -2661,8 +2673,8 @@ class TestDbfCreation(unittest.TestCase):
++                   'litres F(11,5)', 'blob G', 'graphic P', 'weight F(7,3)']
 +         for i in range(1, len(fields)+1):
 +             for fieldlist in combinate(fields, i):
 +-                table = Table(os.path.join(tempdir, 'tempfp'), ';'.join(fieldlist), dbf_type='vfp')
 +-                table = Table(os.path.join(tempdir, 'tempfp'), dbf_type='vfp')
 ++                table = Table(os.path.join(self.tempdir, 'tempfp'), ';'.join(fieldlist), dbf_type='vfp')
 ++                table = Table(os.path.join(self.tempdir, 'tempfp'), dbf_type='vfp')
 +                 actualFields = table.structure()
 +                 self.assertEqual(fieldlist, actualFields)
 +     def test_vfp_memory_tables(self):
- @@ -2681,19 +2693,19 @@ class TestDbfCreation(unittest.TestCase):
-                    ]
++@@ -2685,19 +2697,19 @@ class TestDbfCreation(unittest.TestCase):
++                   'weight F(7,3)']
 +         for i in range(1, len(fields)+1):
 +             for fieldlist in combinate(fields, i):
 +-                table = Table(os.path.join(tempdir, 'tempvfp'), ';'.join(fieldlist), dbf_type='vfp')
 +-                table = Table(os.path.join(tempdir, 'tempvfp'), dbf_type='vfp')
 ++                table = Table(os.path.join(self.tempdir, 'tempvfp'), ';'.join(fieldlist), dbf_type='vfp')
 ++                table = Table(os.path.join(self.tempdir, 'tempvfp'), dbf_type='vfp')
 +                 actualFields = table.structure()
 +                 fieldlist = [f.replace('nocptrans','binary') for f in fieldlist]
 +                 self.assertEqual(fieldlist, actualFields)
 +     def test_codepage(self):
 +-        table = Table(os.path.join(tempdir, 'tempvfp'), 'name C(25); male L; fired D null', dbf_type='vfp')
 ++        table = Table(os.path.join(self.tempdir, 'tempvfp'), 'name C(25); male L; fired D null', dbf_type='vfp')
 +         self.assertEqual(dbf.default_codepage, 'ascii')
 +         self.assertEqual(table.codepage, dbf.CodePage('ascii'))
 +         table.close()
 +         table.open()
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'tempvfp'), 'name C(25); male L; fired D null', dbf_type='vfp', codepage='cp850')
 ++        table = Table(os.path.join(self.tempdir, 'tempvfp'), 'name C(25); male L; fired D null', dbf_type='vfp', codepage='cp850')
 +         self.assertEqual(table.codepage, dbf.CodePage('cp850'))
 + 
 +         newtable = table.new('tempvfp2', codepage='cp437')
- @@ -2701,43 +2713,43 @@ class TestDbfCreation(unittest.TestCase):
++@@ -2705,43 +2717,43 @@ class TestDbfCreation(unittest.TestCase):
 +         newtable.open()
 +         newtable.create_backup()
 +         newtable.close()
 +-        bckup = Table(os.path.join(tempdir, newtable.backup))
 ++        bckup = Table(os.path.join(self.tempdir, newtable.backup))
 +         self.assertEqual(bckup.codepage, newtable.codepage)
 +     def test_db3_ignore_memos(self):
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='db3').open()
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='db3').open()
 +         table.append(('QC Tester', 'check it twice!  check it thrice!  check it . . . uh . . . again!'))
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), dbf_type='db3', ignore_memos=True)
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), dbf_type='db3', ignore_memos=True)
 +         table.open()
 +         try:
 +             self.assertEqual(table[0].wisdom, '')
 +         finally:
 +             table.close()
 +     def test_fp_ignore_memos(self):
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='fp').open()
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='fp').open()
 +         table.append(('QC Tester', 'check it twice!  check it thrice!  check it . . . uh . . . again!'))
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), dbf_type='fp', ignore_memos=True)
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), dbf_type='fp', ignore_memos=True)
 +         table.open()
 +         try:
 +             self.assertEqual(table[0].wisdom, '')
 +         finally:
 +             table.close()
 +     def test_vfp_ignore_memos(self):
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='vfp').open()
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='vfp').open()
 +         table.append(('QC Tester', 'check it twice!  check it thrice!  check it . . . uh . . . again!'))
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), dbf_type='vfp', ignore_memos=True)
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), dbf_type='vfp', ignore_memos=True)
 +         table.open()
 +         try:
 +             self.assertEqual(table[0].wisdom, '')
 +         finally:
 +             table.close()
 +     def test_clp_ignore_memos(self):
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='clp').open()
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), 'name C(25); wisdom M', dbf_type='clp').open()
 +         table.append(('QC Tester', 'check it twice!  check it thrice!  check it . . . uh . . . again!'))
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'tempdb3'), dbf_type='clp', ignore_memos=True)
 ++        table = Table(os.path.join(self.tempdir, 'tempdb3'), dbf_type='clp', ignore_memos=True)
 +         table.open()
 +         try:
 +             self.assertEqual(table[0].wisdom, '')
- @@ -2746,16 +2758,16 @@ class TestDbfCreation(unittest.TestCase):
++@@ -2750,14 +2762,16 @@ class TestDbfCreation(unittest.TestCase):
 + 
 + class TestDbfRecords(unittest.TestCase):
 +     "Testing records"
 ++
 +     def setUp(self):
- -        #if not os.path.exists(tempdir):
- -        #    os.mkdir(tempdir)
 ++        self.tempdir = tempfile.mkdtemp()
 +         self.dbf_table = Table(
 +-                os.path.join(tempdir, 'dbf_table'),
 ++                os.path.join(self.tempdir, 'dbf_table'),
 +                 'name C(25); paid L; qty N(11,5); orderdate D; desc M',
 +                 dbf_type='db3',
 +                 )
 +         self.vfp_table = Table(
 +-                os.path.join(tempdir, 'vfp_table'),
 ++                os.path.join(self.tempdir, 'vfp_table'),
 +                 'name C(25); paid L; qty N(11,5); orderdate D; desc M; mass B;' +
 +                 ' weight F(18,3); age I; meeting T; misc G; photo P; price Y',
 +                 dbf_type='vfp',
- @@ -2764,7 +2776,7 @@ class TestDbfRecords(unittest.TestCase):
++@@ -2766,6 +2780,7 @@ class TestDbfRecords(unittest.TestCase):
 +     def tearDown(self):
 +         self.dbf_table.close()
 +         self.vfp_table.close()
- -        #shutil.rmtree(tempdir)
 ++        shutil.rmtree(self.tempdir, True)
 + 
 +     def test_slicing(self):
 +         table = self.dbf_table
- @@ -3428,9 +3440,10 @@ class TestDbfRecords(unittest.TestCase):
++@@ -3488,9 +3503,10 @@ class TestDbfRecordTemplates(unittest.TestCase):
 + 
 + class TestDbfFunctions(unittest.TestCase):
 +     def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 +         "create a dbf and vfp table"
 +         self.dbf_table = table = Table(
 +-            os.path.join(tempdir, 'temptable'),
 ++            os.path.join(self.tempdir, 'temptable'),
 +             'name C(25); paid L; qty N(11,5); orderdate D; desc M', dbf_type='db3'
 +             )
 +         table.open()
- @@ -3454,7 +3467,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3514,7 +3530,7 @@ class TestDbfFunctions(unittest.TestCase):
 +         table.close()
 + 
 +         self.vfp_table = table = Table(
 +-                os.path.join(tempdir, 'tempvfp'),
 ++                os.path.join(self.tempdir, 'tempvfp'),
 +                 'name C(25); paid L; qty N(11,5); orderdate D; desc M; mass B;'
 +                 ' weight F(18,3); age I; meeting T; misc G; photo P',
 +                 dbf_type='vfp',
- @@ -3503,6 +3516,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3563,6 +3579,7 @@ class TestDbfFunctions(unittest.TestCase):
 +     def tearDown(self):
 +         self.dbf_table.close()
 +         self.vfp_table.close()
 ++        shutil.rmtree(self.tempdir, True)
 + 
 +     def test_add_fields_to_dbf_table(self):
 +         "dbf table:  adding and deleting fields"
- @@ -3748,7 +3762,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3808,7 +3825,7 @@ class TestDbfFunctions(unittest.TestCase):
 +         table.open()
 +         table.append(multiple=10)
 +         self.assertEqual(table.next_record, table[0])
 +-        table = self.dbf_table              # Table(os.path.join(tempdir, 'temptable'), dbf_type='db3')
 ++        table = self.dbf_table              # Table(os.path.join(self.tempdir, 'temptable'), dbf_type='db3')
 +         table.open()
 +         total = len(table)
 +         table.bottom()
- @@ -3794,7 +3808,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3854,7 +3871,7 @@ class TestDbfFunctions(unittest.TestCase):
 + 
 +         # check that deletes were saved to disk..
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable'), dbf_type='db3')
 ++        table = Table(os.path.join(self.tempdir, 'temptable'), dbf_type='db3')
 +         table.open()
 +         active_records = table.create_index(active)
 +         i = 0
- @@ -3940,7 +3954,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4000,7 +4017,7 @@ class TestDbfFunctions(unittest.TestCase):
 +         qtylist = self.dbf_qtylist
 +         orderlist = self.dbf_orderlist
 +         desclist = self.dbf_desclist
 +-        table2 = table.new(os.path.join(tempdir, 'temptable2'))
 ++        table2 = table.new(os.path.join(self.tempdir, 'temptable2'))
 +         table2.open()
 +         for record in table:
 +             table2.append()
- @@ -3953,7 +3967,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4013,7 +4030,7 @@ class TestDbfFunctions(unittest.TestCase):
 +                 self.assertEqual(newrecord[field], record[field])
 +         table2.close()
 +         table2 = None
 +-        table2 = Table(os.path.join(tempdir, 'temptable2'), dbf_type='db3')
 ++        table2 = Table(os.path.join(self.tempdir, 'temptable2'), dbf_type='db3')
 +         table2.open()
 +         for i in range(len(table)):
 +             temp1 = dbf.scatter(table[i])
- @@ -3992,7 +4006,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4052,7 +4069,7 @@ class TestDbfFunctions(unittest.TestCase):
 +             self.assertEqual(oldfield in table.field_names, False)
 +             self.assertEqual('newfield' in table.field_names, True)
 +             table.close()
 +-            table = Table(os.path.join(tempdir, 'temptable'), dbf_type='db3')
 ++            table = Table(os.path.join(self.tempdir, 'temptable'), dbf_type='db3')
 +             table.open()
 +             self.assertEqual(oldfield in table.field_names, False)
 +             self.assertEqual('newfield' in table.field_names, True)
- @@ -4010,7 +4024,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4070,7 +4087,7 @@ class TestDbfFunctions(unittest.TestCase):
 +         qtylist = self.dbf_qtylist
 +         orderlist = self.dbf_orderlist
 +         desclist = self.dbf_desclist
 +-        table2 = table.new(os.path.join(tempdir, 'temptable2'))
 ++        table2 = table.new(os.path.join(self.tempdir, 'temptable2'))
 +         table2.open()
 +         for record in table:
 +             table2.append(record)
- @@ -4022,7 +4036,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4082,7 +4099,7 @@ class TestDbfFunctions(unittest.TestCase):
 +                 if key not in table2.memo_types:
 +                     self.assertEqual(newrecord[field], record[field])
 +         table2.close()
 +-        table2 = Table(os.path.join(tempdir, 'temptable2'), dbf_type='db3')
 ++        table2 = Table(os.path.join(self.tempdir, 'temptable2'), dbf_type='db3')
 +         table2.open()
 +         for i in range(len(table)):
 +             dict1 = dbf.scatter(table[i], as_type=dict)
- @@ -4054,7 +4068,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4114,7 +4131,7 @@ class TestDbfFunctions(unittest.TestCase):
 +         qtylist = self.dbf_qtylist
 +         orderlist = self.dbf_orderlist
 +         desclist = self.dbf_desclist
 +-        table2 = table.new(os.path.join(tempdir, 'temptable2'))
 ++        table2 = table.new(os.path.join(self.tempdir, 'temptable2'))
 +         table2.open()
 +         record = table.next_record
 +         table2.append(dbf.scatter(record), multiple=100)
- @@ -4062,13 +4076,13 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4122,13 +4139,13 @@ class TestDbfFunctions(unittest.TestCase):
 +             for field in dbf.field_names(record):
 +                 self.assertEqual(record[field], samerecord[field])
 +         table2.close()
 +-        table2 = Table(os.path.join(tempdir, 'temptable2'), dbf_type='db3')
 ++        table2 = Table(os.path.join(self.tempdir, 'temptable2'), dbf_type='db3')
 +         table2.open()
 +         for samerecord in table2:
 +             for field in dbf.field_names(record):
 +                 self.assertEqual(record[field], samerecord[field])
 +         table2.close()
 +-        table3 = table.new(os.path.join(tempdir, 'temptable3'))
 ++        table3 = table.new(os.path.join(self.tempdir, 'temptable3'))
 +         table3.open()
 +         record = table.next_record
 +         table3.append(record, multiple=100)
- @@ -4076,7 +4090,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4136,7 +4153,7 @@ class TestDbfFunctions(unittest.TestCase):
 +             for field in dbf.field_names(record):
 +                 self.assertEqual(record[field], samerecord[field])
 +         table3.close()
 +-        table3 = Table(os.path.join(tempdir, 'temptable3'), dbf_type='db3')
 ++        table3 = Table(os.path.join(self.tempdir, 'temptable3'), dbf_type='db3')
 +         table3.open()
 +         for samerecord in table3:
 +             for field in dbf.field_names(record):
- @@ -4132,35 +4146,35 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4192,35 +4209,35 @@ class TestDbfFunctions(unittest.TestCase):
 +         dbf.write(table[0], motto='Are we there yet??')
 +         self.assertEqual(table[0].motto, 'Are we there yet??')
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), 'name C(50); age N(3,0)', dbf_type='db3')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), 'name C(50); age N(3,0)', dbf_type='db3')
 +         table.open()
 +         table.append(('user', 0))
 +         table.close()
 +         table.open()
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), dbf_type='db3')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), dbf_type='db3')
 +         table.open()
 +         table.add_fields('motto M')
 +         dbf.write(table[0], motto='Are we there yet??')
 +         self.assertEqual(table[0].motto, 'Are we there yet??')
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), dbf_type='db3')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), dbf_type='db3')
 +         table.open()
 +         self.assertEqual(table[0].motto, 'Are we there yet??')
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), 'name C(50); age N(3,0)', dbf_type='vfp')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), 'name C(50); age N(3,0)', dbf_type='vfp')
 +         table.open()
 +         table.append(('user', 0))
 +         table.close()
 +         table.open()
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), dbf_type='vfp')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), dbf_type='vfp')
 +         table.open()
 +         table.add_fields('motto M')
 +         dbf.write(table[0], motto='Are we there yet??')
 +         self.assertEqual(table[0].motto, 'Are we there yet??')
 +         table.close()
 +-        table = Table(os.path.join(tempdir, 'temptable4'), dbf_type='vfp')
 ++        table = Table(os.path.join(self.tempdir, 'temptable4'), dbf_type='vfp')
 +         table.open()
 +         self.assertEqual(table[0].motto, 'Are we there yet??')
 +         table.close()
- @@ -4174,49 +4188,49 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4234,49 +4251,49 @@ class TestDbfFunctions(unittest.TestCase):
 +         orderlist = self.dbf_orderlist
 +         desclist = self.dbf_desclist
 +         dbf.export(table, table.filename, header=False)
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]), csvtable[i][j])
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), to_disk=True, filename=os.path.join(tempdir, 'temptable5'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), to_disk=True, filename=os.path.join(self.tempdir, 'temptable5'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]).strip(), csvtable[i][j].strip())
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), field_names=['field1','field2'])
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), field_names=['field1','field2'])
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]), csvtable[i][j])
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), field_names=['field1','field2'], to_disk=True, filename=os.path.join(tempdir, 'temptable5'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), field_names=['field1','field2'], to_disk=True, filename=os.path.join(self.tempdir, 'temptable5'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]).strip(), csvtable[i][j].strip())
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), extra_fields=['count N(5,0)','id C(10)'])
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), extra_fields=['count N(5,0)','id C(10)'])
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]), csvtable[i][j])
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), extra_fields=['count N(5,0)','id C(10)'], to_disk=True, filename=os.path.join(tempdir, 'temptable5'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), extra_fields=['count N(5,0)','id C(10)'], to_disk=True, filename=os.path.join(self.tempdir, 'temptable5'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]).strip(), csvtable[i][j].strip())
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), field_names=['name','qty','paid','desc'], extra_fields='test1 C(15);test2 L'.split(';'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), field_names=['name','qty','paid','desc'], extra_fields='test1 C(15);test2 L'.split(';'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
 +                 self.assertEqual(str(table[i][j]), csvtable[i][j])
 +         csvtable.close()
 +-        csvtable = dbf.from_csv(os.path.join(tempdir, 'temptable.csv'), field_names=['name','qty','paid','desc'], extra_fields='test1 C(15);test2 L'.split(';'), to_disk=True, filename=os.path.join(tempdir, 'temptable5'))
 ++        csvtable = dbf.from_csv(os.path.join(self.tempdir, 'temptable.csv'), field_names=['name','qty','paid','desc'], extra_fields='test1 C(15);test2 L'.split(';'), to_disk=True, filename=os.path.join(self.tempdir, 'temptable5'))
 +         csvtable.open()
 +         for i in index(table):
 +             for j in index(table.field_names):
- @@ -4367,9 +4381,10 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4427,9 +4444,10 @@ class TestDbfFunctions(unittest.TestCase):
 + 
 + class TestDbfNavigation(unittest.TestCase):
 +     def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 +         "create a dbf and vfp table"
 +         self.dbf_table = table = Table(
 +-            os.path.join(tempdir, 'temptable'),
 ++            os.path.join(self.tempdir, 'temptable'),
 +             'name C(25); paid L; qty N(11,5); orderdate D; desc M', dbf_type='db3'
 +             )
 +         table.open()
- @@ -4393,7 +4408,7 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4453,7 +4471,7 @@ class TestDbfNavigation(unittest.TestCase):
 +         table.close()
 + 
 +         self.vfp_table = table = Table(
 +-                os.path.join(tempdir, 'tempvfp'),
 ++                os.path.join(self.tempdir, 'tempvfp'),
 +                 'name C(25); paid L; qty N(11,5); orderdate D; desc M; mass B;'
 +                 ' weight F(18,3); age I; meeting T; misc G; photo P',
 +                 dbf_type='vfp',
- @@ -4442,6 +4457,7 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4502,6 +4520,7 @@ class TestDbfNavigation(unittest.TestCase):
 +     def tearDown(self):
 +         self.dbf_table.close()
 +         self.vfp_table.close()
 ++        shutil.rmtree(self.tempdir, True)
 + 
 +     def test_top(self):
 +         "top, current in Tables, Lists, and Indexes"
- @@ -4668,9 +4684,10 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4728,9 +4747,10 @@ class TestDbfNavigation(unittest.TestCase):
 + class TestDbfLists(unittest.TestCase):
 +     "DbfList tests"
 +     def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 +         "create a dbf table"
 +         self.dbf_table = table = Table(
 +-            os.path.join(tempdir, 'temptable'),
 ++            os.path.join(self.tempdir, 'temptable'),
 +             'name C(25); paid L; qty N(11,5); orderdate D; desc M', dbf_type='db3'
 +             )
 +         table.open()
- @@ -4695,6 +4712,7 @@ class TestDbfLists(unittest.TestCase):
++@@ -4755,6 +4775,7 @@ class TestDbfLists(unittest.TestCase):
 +         table.close()
 +     def tearDown(self):
 +         self.dbf_table.close()
 ++        shutil.rmtree(self.tempdir, True)
 +     def test_exceptions(self):
 +         table = self.dbf_table
 +         table.open()
- @@ -4819,9 +4837,10 @@ class TestDbfLists(unittest.TestCase):
++@@ -4879,9 +4900,10 @@ class TestDbfLists(unittest.TestCase):
 + class TestWhatever(unittest.TestCase):
 +     "move tests here to run one at a time while debugging"
 +     def setUp(self):
 ++        self.tempdir = tempfile.mkdtemp()
 +         "create a dbf and vfp table"
 +         self.dbf_table = table = Table(
 +-            os.path.join(tempdir, 'temptable'),
 ++            os.path.join(self.tempdir, 'temptable'),
 +             'name C(25); paid L; qty N(11,5); orderdate D; desc M', dbf_type='db3'
 +             )
 +         table.open()
- @@ -4845,7 +4864,7 @@ class TestWhatever(unittest.TestCase):
++@@ -4905,7 +4927,7 @@ class TestWhatever(unittest.TestCase):
 +         table.close()
 + 
 +         self.vfp_table = table = Table(
 +-                os.path.join(tempdir, 'tempvfp'),
 ++                os.path.join(self.tempdir, 'tempvfp'),
 +                 'name C(25); paid L; qty N(11,5); orderdate D; desc M; mass B;'
 +                 ' weight F(18,3); age I; meeting T; misc G; photo P',
 +                 dbf_type='vfp',
- @@ -4894,10 +4913,7 @@ class TestWhatever(unittest.TestCase):
++@@ -4954,10 +4976,7 @@ class TestWhatever(unittest.TestCase):
 +     def tearDown(self):
 +         self.dbf_table.close()
 +         self.vfp_table.close()
 ++        shutil.rmtree(self.tempdir, True)
 + # main
 + if __name__ == '__main__':
 +-    tempdir = tempfile.mkdtemp()
 +-    try:
 +-        unittest.main()
 +-    finally:
 +-        shutil.rmtree(tempdir, True)
 ++    unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/dbf.git



More information about the Python-modules-commits mailing list