summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Szakmeister <john@szakmeister.net>2015-11-28 05:03:09 -0500
committerJohn Szakmeister <john@szakmeister.net>2015-11-28 05:03:09 -0500
commit16df8f4901b3328691263573eae1f1f94874f19b (patch)
tree8a51c16f80452c6308d4fe49958b3b38b9fa1115
parent53ca70f5ccd41ed8ced343728c784363f0f8c818 (diff)
downloadnose-16df8f4901b3328691263573eae1f1f94874f19b.tar.gz
testid: don't traceback if the idfile doesn't exist
-rw-r--r--nose/plugins/testid.py55
1 files changed, 28 insertions, 27 deletions
diff --git a/nose/plugins/testid.py b/nose/plugins/testid.py
index 0f94c87..894608d 100644
--- a/nose/plugins/testid.py
+++ b/nose/plugins/testid.py
@@ -176,36 +176,37 @@ class TestId(Plugin):
test addresses, if they are found in my dict of tests.
"""
log.debug('ltfn %s %s', names, module)
- fh = open(self.idfile, 'rb')
try:
- data = load(fh)
- if 'ids' in data:
- self.ids = data['ids']
- self.failed = data['failed']
- self.source_names = data['source_names']
- else:
- # old ids field
- self.ids = data
- self.failed = []
- self.source_names = names
- if self.ids:
- self.id = max(self.ids) + 1
- self.tests = dict(list(zip(list(self.ids.values()), list(self.ids.keys()))))
- else:
- self.id = 1
- log.debug(
- 'Loaded test ids %s tests %s failed %s sources %s from %s',
- self.ids, self.tests, self.failed, self.source_names,
- self.idfile)
- except ValueError, e:
- # load() may throw a ValueError when reading the ids file, if it
- # was generated with a newer version of Python than we are currently
- # running.
- log.debug('Error loading %s : %s', self.idfile, str(e))
+ fh = open(self.idfile, 'rb')
+ try:
+ data = load(fh)
+ if 'ids' in data:
+ self.ids = data['ids']
+ self.failed = data['failed']
+ self.source_names = data['source_names']
+ else:
+ # old ids field
+ self.ids = data
+ self.failed = []
+ self.source_names = names
+ if self.ids:
+ self.id = max(self.ids) + 1
+ self.tests = dict(list(zip(list(self.ids.values()), list(self.ids.keys()))))
+ else:
+ self.id = 1
+ log.debug(
+ 'Loaded test ids %s tests %s failed %s sources %s from %s',
+ self.ids, self.tests, self.failed, self.source_names,
+ self.idfile)
+ except ValueError, e:
+ # load() may throw a ValueError when reading the ids file, if it
+ # was generated with a newer version of Python than we are currently
+ # running.
+ log.debug('Error loading %s : %s', self.idfile, str(e))
+ finally:
+ fh.close()
except IOError:
log.debug('IO error reading %s', self.idfile)
- finally:
- fh.close()
if self.loopOnFailed and self.failed:
self.collecting = False