Merge pull request #1620 from ilvalle/issue_1618

fix cron with py3, added initial tests, close #1618
This commit is contained in:
mdipierro
2017-05-03 23:57:12 -05:00
committed by GitHub
3 changed files with 31 additions and 3 deletions
+1
View File
@@ -23,6 +23,7 @@ from .test_appadmin import *
from .test_web import *
from .test_sqlhtml import *
from .test_scheduler import *
from .test_cron import *
if sys.version[:3] == '2.7':
from .test_is_url import *
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit tests for cron """
import unittest, os
from gluon.newcron import Token, crondance
class TestCron(unittest.TestCase):
def test_Token(self):
appname_path = os.path.join(os.getcwd(), 'applications', 'welcome')
t = Token(path=appname_path)
self.assertNotEqual(t.acquire(), None)
self.assertFalse(t.release())
self.assertEqual(t.acquire(), None)
self.assertTrue(t.release())
return
def test_crondance(self):
#TODO update crondance to return something
crondance(os.getcwd())