Browse Source

Improve test coverage

tags/nilmdb-2.0.0
Jim Paris 1 year ago
parent
commit
4958a5ab2e
2 changed files with 5 additions and 3 deletions
  1. +1
    -3
      nilmdb/server/nilmdb.py
  2. +4
    -0
      tests/test_nilmdb.py

+ 1
- 3
nilmdb/server/nilmdb.py View File

@@ -111,9 +111,7 @@ class NilmDB(object):
try:
os.makedirs(self.basepath)
except OSError as e:
if e.errno != errno.EEXIST: # pragma: no cover
# (no coverage, because it's hard to trigger this case
# if tests are run as root)
if e.errno != errno.EEXIST:
raise IOError("can't create tree " + self.basepath)

# Our data goes inside it


+ 4
- 0
tests/test_nilmdb.py View File

@@ -46,6 +46,10 @@ class Test00Nilmdb(object): # named 00 so it runs first
db.close()
db.close()

with assert_raises(OSError) as e:
nilmdb.server.NilmDB("/dev/null/bogus")
in_("can't create tree", str(e.exception))

def test_stream(self):
db = nilmdb.server.NilmDB(testdb)
eq_(db.stream_list(), [])


Loading…
Cancel
Save