Browse Source

Fix test failure when tests are run as root

tags/nilmdb-1.4.4
Jim Paris 9 years ago
parent
commit
e790bb9e8a
2 changed files with 3 additions and 4 deletions
  1. +3
    -1
      nilmdb/server/nilmdb.py
  2. +0
    -3
      tests/test_nilmdb.py

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

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

# Our data goes inside it


+ 0
- 3
tests/test_nilmdb.py View File

@@ -28,9 +28,6 @@ class Test00Nilmdb(object): # named 00 so it runs first
def test_NilmDB(self):
recursive_unlink(testdb)

with assert_raises(IOError):
nilmdb.server.NilmDB("/nonexistant-db/foo")

db = nilmdb.server.NilmDB(testdb)
db.close()
db = nilmdb.server.NilmDB(testdb)


Loading…
Cancel
Save