[Python-modules-commits] [dbf] 02/03: merge patched into master
Sandro Tosi
morph at moszumanska.debian.org
Wed Nov 4 21:34:00 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 842c463621e6d1cca8743fd8cc697f8365837e9b
Merge: 457c1a4 7019625
Author: Sandro Tosi <morph at debian.org>
Date: Wed Nov 4 21:01:03 2015 +0000
merge patched into master
dbf/tests.py | 6 +-
debian/.git-dpm | 4 +-
...x-tests-so-that-they-don-t-require-a-main.patch | 79 ++++++++++++++--------
3 files changed, 58 insertions(+), 31 deletions(-)
diff --cc debian/.git-dpm
index a684c14,0000000..2f4b0a7
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
- f4b386ea7919f47aab2fc73ddda086c01de894da
- f4b386ea7919f47aab2fc73ddda086c01de894da
++7019625317141591892e32b027441a5560abd3c1
++7019625317141591892e32b027441a5560abd3c1
+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 d151e7f,0000000..d73812f
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,504 -1,0 +1,529 @@@
- From f4b386ea7919f47aab2fc73ddda086c01de894da Mon Sep 17 00:00:00 2001
++From 7019625317141591892e32b027441a5560abd3c1 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 | 141 +++++++++++++++++++++++++++++++++--------------------------
- 1 file changed, 80 insertions(+), 61 deletions(-)
++ dbf/tests.py | 147 ++++++++++++++++++++++++++++++++++-------------------------
++ 1 file changed, 84 insertions(+), 63 deletions(-)
+
+diff --git a/dbf/tests.py b/dbf/tests.py
- index 1981b9a..e0d3cc7 100644
++index 1981b9a..a68478a 100644
+--- a/dbf/tests.py
++++ b/dbf/tests.py
+@@ -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)
+@@ -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):
+@@ -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"
+@@ -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')
+@@ -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)', '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')
+@@ -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):
+@@ -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')
+@@ -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, '')
+@@ -2750,14 +2762,16 @@ class TestDbfCreation(unittest.TestCase):
+
+ class TestDbfRecords(unittest.TestCase):
+ "Testing records"
++
+ def setUp(self):
++ 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',
+@@ -2766,6 +2780,7 @@ class TestDbfRecords(unittest.TestCase):
+ def tearDown(self):
+ self.dbf_table.close()
+ self.vfp_table.close()
++ shutil.rmtree(self.tempdir, True)
+
+ def test_slicing(self):
+ table = self.dbf_table
- @@ -3488,9 +3503,10 @@ class TestDbfRecordTemplates(unittest.TestCase):
++@@ -3441,13 +3456,14 @@ class TestDbfRecords(unittest.TestCase):
++ class TestDbfRecordTemplates(unittest.TestCase):
++ "Testing records"
++ def setUp(self):
+++ 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',
++@@ -3456,6 +3472,7 @@ class TestDbfRecordTemplates(unittest.TestCase):
++ def tearDown(self):
++ self.dbf_table.close()
++ self.vfp_table.close()
+++ shutil.rmtree(self.tempdir, True)
++
++ def test_dbf_storage(self):
++ table = self.dbf_table
++@@ -3488,9 +3505,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()
- @@ -3514,7 +3530,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3514,7 +3532,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',
- @@ -3563,6 +3579,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3563,6 +3581,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"
- @@ -3808,7 +3825,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3808,7 +3827,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()
- @@ -3854,7 +3871,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -3854,7 +3873,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
- @@ -4000,7 +4017,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4000,7 +4019,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()
- @@ -4013,7 +4030,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4013,7 +4032,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])
- @@ -4052,7 +4069,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4052,7 +4071,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)
- @@ -4070,7 +4087,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4070,7 +4089,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)
- @@ -4082,7 +4099,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4082,7 +4101,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)
- @@ -4114,7 +4131,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4114,7 +4133,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)
- @@ -4122,13 +4139,13 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4122,13 +4141,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)
- @@ -4136,7 +4153,7 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4136,7 +4155,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):
- @@ -4192,35 +4209,35 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4192,35 +4211,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()
- @@ -4234,49 +4251,49 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4234,49 +4253,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):
- @@ -4427,9 +4444,10 @@ class TestDbfFunctions(unittest.TestCase):
++@@ -4427,9 +4446,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()
- @@ -4453,7 +4471,7 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4453,7 +4473,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',
- @@ -4502,6 +4520,7 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4502,6 +4522,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"
- @@ -4728,9 +4747,10 @@ class TestDbfNavigation(unittest.TestCase):
++@@ -4728,9 +4749,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()
- @@ -4755,6 +4775,7 @@ class TestDbfLists(unittest.TestCase):
++@@ -4755,6 +4777,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()
- @@ -4879,9 +4900,10 @@ class TestDbfLists(unittest.TestCase):
++@@ -4879,9 +4902,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()
- @@ -4905,7 +4927,7 @@ class TestWhatever(unittest.TestCase):
++@@ -4905,7 +4929,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',
- @@ -4954,10 +4976,7 @@ class TestWhatever(unittest.TestCase):
++@@ -4954,10 +4978,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