Esempio n. 1
0
 def test_valid_internal_task(self):
     dirname = tempfile.mkdtemp()
     testfile = os.path.join(dirname, 'Mowfile')
     mk_mowfile(testfile)
     args = ['list', '-C', dirname]
     self.assertEquals(0, mow.main(args))
     os.unlink(testfile)
     if os.path.exists(testfile+'c'):
         os.unlink(testfile+'c')
     os.rmdir(dirname)
Esempio n. 2
0
 def test_missing_task(self):
     dirname = tempfile.mkdtemp()
     testfile = os.path.join(dirname, 'Mowfile')
     mk_mowfile(testfile)
     args = ['no_task', '-C', dirname]
     self.assertEquals(1, mow.main(args))
     os.unlink(testfile)
     if os.path.exists(testfile+'c'):
         os.unlink(testfile+'c')
     os.listdir(dirname)
     os.rmdir(dirname)
Esempio n. 3
0
 def test_bad_Mowfile(self):
     dirname = tempfile.mkdtemp()
     testfile = os.path.join(dirname, 'Mowfile')
     code = [
         'import mow\n', '\n', "@mow.task('test:task')\n", 
         'def test_task():\n','    print("hello)\n'
     ]
     mk_mowfile(testfile, code)
     args = ['list', '-C', dirname]
     self.assertEquals(1, mow.main(args))
     os.unlink(testfile)
     os.rmdir(dirname)
Esempio n. 4
0
 def test_task_error(self):
     dirname = tempfile.mkdtemp()
     testfile = os.path.join(dirname, 'Mowfile')
     code = [
         'import mow\n', '\n', "@mow.task('test:task')\n", 
         'def test_task():\n','    raise RuntimeError("Error")\n'
     ]
     mk_mowfile(testfile, code)
     args = ['test:task', '-C', dirname]
     self.assertEquals(1, mow.main(args))
     os.unlink(testfile)
     if os.path.exists(testfile+'c'):
         os.unlink(testfile+'c')
     os.rmdir(dirname)