~pythonregexp2.7/python/issue2636

« back to all changes in this revision

Viewing changes to Lib/bsddb/test/test_dbtables.py

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-05-24 16:05:21 UTC
  • mfrom: (39021.1.401 Regexp-2.6)
  • Revision ID: darklord@timehorse.com-20080524160521-1xenj7p6u3wb89et
Merged in changes from the latest python source snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
# $Id$
22
22
 
23
23
import os, re
24
 
import tempfile
25
24
try:
26
25
    import cPickle
27
26
    pickle = cPickle
28
27
except ImportError:
29
28
    import pickle
30
 
import tempfile
31
29
 
32
30
import unittest
33
 
from test_all import verbose
 
31
from test_all import verbose, get_new_environment_path, get_new_database_path
34
32
 
35
33
try:
36
34
    # For Pythons w/distutils pybsddb
48
46
#----------------------------------------------------------------------
49
47
 
50
48
class TableDBTestCase(unittest.TestCase):
51
 
    db_home = 'db_home'
52
49
    db_name = 'test-table.db'
53
50
 
54
51
    def setUp(self):
55
 
        homeDir = tempfile.mkdtemp()
56
 
        self.testHomeDir = homeDir
57
 
        try: os.mkdir(homeDir)
58
 
        except os.error: pass
 
52
        self.testHomeDir = get_new_environment_path()
59
53
        self.tdb = dbtables.bsdTableDB(
60
 
            filename='tabletest.db', dbhome=homeDir, create=1)
 
54
            filename='tabletest.db', dbhome=self.testHomeDir, create=1)
61
55
 
62
56
    def tearDown(self):
63
57
        self.tdb.close()
323
317
        self.tdb.Insert(tabname, {'Type': 'Unknown', 'Access': '0'})
324
318
 
325
319
        def set_type(type):
326
 
            if type is None:
 
320
            if type == None:
327
321
                return 'MP3'
328
322
            return type
329
323