Skip to content

Commit 5bfcc4b

Browse files
committed
Fix minor problems in tests
Make gpg test fault tolerant against existing directory. Fix path problems for new auditor.
1 parent a27f2c1 commit 5bfcc4b

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

test/gpgmelib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118

119119
pgphome = 'pgp-test-home'
120120
def setUpPGP():
121+
# prevent test from failing if left over from earlier run:
122+
if os.path.exists(pgphome):
123+
shutil.rmtree(pgphome)
121124
os.mkdir(pgphome)
122125
os.environ['GNUPGHOME'] = pgphome
123126
# gpgme_check_version() must have been called once in a programm

test/memorydb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def create(journaltag, create=True, debug=False):
4242
execfile(initial_data, vars)
4343

4444
# load standard detectors
45-
dirname = os.path.join(os.path.dirname(__file__),
45+
thisdir = os.path.dirname(__file__)
46+
dirname = os.path.join(thisdir,
4647
'../share/roundup/templates/classic/detectors')
4748
for fn in os.listdir(dirname):
4849
if not fn.endswith('.py'): continue
@@ -51,7 +52,7 @@ def create(journaltag, create=True, debug=False):
5152
vars['init'](db)
5253

5354
vars = {}
54-
execfile("test/tx_Source_detector.py", vars)
55+
execfile(os.path.join(thisdir, "tx_Source_detector.py"), vars)
5556
vars['init'](db)
5657

5758
'''

test/test_cgi.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,11 @@ def setUp(self):
8686

8787
self.db.post_init()
8888

89-
vars = dict(globals())
90-
vars['db'] = self.db
9189
vars = {}
92-
execfile("test/tx_Source_detector.py", vars)
90+
thisdir = os.path.dirname(__file__)
91+
execfile(os.path.join(thisdir, "tx_Source_detector.py"), vars)
9392
vars['init'](self.db)
9493

95-
9694
test = self.instance.backend.Class(self.db, "test",
9795
string=hyperdb.String(), number=hyperdb.Number(),
9896
boolean=hyperdb.Boolean(), link=hyperdb.Link('test'),

test/test_xmlrpc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ def setUp(self):
4646

4747
self.db.post_init()
4848

49-
vars = dict(globals())
50-
vars['db'] = self.db
49+
thisdir = os.path.dirname(__file__)
5150
vars = {}
52-
execfile("test/tx_Source_detector.py", vars)
51+
execfile(os.path.join(thisdir, "tx_Source_detector.py"), vars)
5352
vars['init'](self.db)
5453

5554
self.server = RoundupInstance(self.db, self.instance.actions, None)

0 commit comments

Comments
 (0)