diff options
| author | Anton Romanovich <anthony.romanovich@gmail.com> | 2013-02-05 10:40:58 +0600 |
|---|---|---|
| committer | Anton Romanovich <anthony.romanovich@gmail.com> | 2013-02-05 10:40:58 +0600 |
| commit | 410dd606f370360acb6b8137256e3261aaebae40 (patch) | |
| tree | 2f2bf070b0de123d9f7a77f498b25c3d0b579e37 | |
| parent | f31da1caac95a61af88dea31cb41b5cca3d7916b (diff) | |
| download | python-magic-410dd606f370360acb6b8137256e3261aaebae40.tar.gz | |
Fix tests
| -rw-r--r-- | test.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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__': |
