summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Romanovich <anthony.romanovich@gmail.com>2013-02-05 10:40:58 +0600
committerAnton Romanovich <anthony.romanovich@gmail.com>2013-02-05 10:40:58 +0600
commit410dd606f370360acb6b8137256e3261aaebae40 (patch)
tree2f2bf070b0de123d9f7a77f498b25c3d0b579e37
parentf31da1caac95a61af88dea31cb41b5cca3d7916b (diff)
downloadpython-magic-410dd606f370360acb6b8137256e3261aaebae40.tar.gz
Fix tests
-rw-r--r--test.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test.py b/test.py
index a1d450d..6efbb68 100644
--- a/test.py
+++ b/test.py
@@ -12,7 +12,7 @@ class MagicTest(unittest.TestCase):
filename = os.path.join(self.TESTDATA_DIR, filename)
with open(filename, 'rb') as f:
- value = m.from_buffer(f.read(1024))
+ value = m.from_buffer(f.read())
self.assertEqual(value, expected_value)
value = m.from_file(filename)
@@ -53,9 +53,11 @@ class MagicTest(unittest.TestCase):
self.assertRaises(IOError, m.from_file, 'nonexistent')
self.assertRaises(magic.MagicException, magic.Magic,
magic_file='nonexistent')
- os.environ['MAGIC'] = '/nonexistent'
- self.assertRaises(magic.MagicException, magic.Magic)
- del os.environ['MAGIC']
+ os.environ['MAGIC'] = 'nonexistent'
+ try:
+ self.assertRaises(magic.MagicException, magic.Magic)
+ finally:
+ del os.environ['MAGIC']
if __name__ == '__main__':