Commit 10beede5 authored by Thomas Larrieu's avatar Thomas Larrieu

Finished working on tests. Everything should be working fine.

parent 72ad08b9
...@@ -332,14 +332,29 @@ class NonInformativeTests(unittest.TestCase): ...@@ -332,14 +332,29 @@ class NonInformativeTests(unittest.TestCase):
'test', 'test',
{ {
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__), 'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
'cleanup': 'foo\nbar' 'cleanup': 'foo'
} }
) )
os.chdir(self.dir) os.chdir(self.dir)
self.assertFalse(os.path.exists('foo')) self.assertFalse(os.path.exists('foo'))
self.assertFalse(os.path.exists('bar')) with self.assertRaises(IOError):
with self.assertRaises(IOError, recipe.install()) as cm: recipe.install()
print cm.error_code
def test_cleanup_fails_when_file_is_out_of_reach(self):
recipe = self.make_recipe(
{},
'test',
{
'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
'cleanup': '/tmp/foo'
}
)
os.chdir(self.dir)
open('/tmp/foo', 'a')
self.assertTrue(os.path.exists('/tmp/foo'))
with self.assertRaises(IOError):
recipe.install()
def test_suite(): def test_suite():
suite = unittest.TestSuite(( suite = unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment