fix tests
This commit is contained in:
		| @@ -7,10 +7,8 @@ python: | |||||||
| # matrix: | # matrix: | ||||||
|  |  | ||||||
| install: | install: | ||||||
|   - python bootstrap.py |     - python bootstrap.py | ||||||
|   - python -V |     - 'if [[ x"$(python -V 2>&1)" == x"Python 3"* ]];then ./bin/buildout -c py3.cfg;fi' | ||||||
|   - 'echo $SHELL' |     - 'if [[ x"$(python -V 2>&1)" == x"Python 2"* ]];then ./bin/buildout;fi' | ||||||
|   - if [ x"$(python -V)" = x"Python 4"* ];then bin/buidout -c py3.cfg;fi |  | ||||||
|   - if [ x"$(python -V)" = x"Python 2"* ];then bin/buidout;fi |  | ||||||
|  |  | ||||||
| script: bin/test | script: bin/test | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ package-name = croniter | |||||||
| develop = . | develop = . | ||||||
| versions=versions | versions=versions | ||||||
| parts = | parts = | ||||||
| #    tox |  | ||||||
|     scripts |     scripts | ||||||
|     omelette |     omelette | ||||||
|     coverage |     coverage | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								py3.cfg
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								py3.cfg
									
									
									
									
									
								
							| @@ -3,3 +3,7 @@ extends=buildout.cfg | |||||||
| parts-= | parts-= | ||||||
|     omelette |     omelette | ||||||
|     code-analysis |     code-analysis | ||||||
|  | [scripts] | ||||||
|  | eggs-= | ||||||
|  |     ipython | ||||||
|  |     zest.releaser | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							| @@ -46,8 +46,6 @@ setup( | |||||||
|     extras_require={ |     extras_require={ | ||||||
|         'test': [ |         'test': [ | ||||||
|             "pytz", |             "pytz", | ||||||
|             'plone.testing', |  | ||||||
|             "zope.interface", |  | ||||||
|         ], |         ], | ||||||
|     }, |     }, | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -93,17 +93,17 @@ class croniter(object): | |||||||
|                         raise ValueError( |                         raise ValueError( | ||||||
|                             "[{0}] is not acceptable".format(expr_format)) |                             "[{0}] is not acceptable".format(expr_format)) | ||||||
|  |  | ||||||
|                     #low, high, step = map(int, [low, high, step]) |                     low, high, step = map(int, [low, high, step]) | ||||||
|                     #e_list += range(low, high + 1, step) |                     e_list += range(low, high + 1, step) | ||||||
|                     # other solution |                     # other solution | ||||||
|                     try: |                     #try: | ||||||
|                         for j in xrange(int(low), int(high) + 1): |                     #    for j in xrange(int(low), int(high) + 1): | ||||||
|                             if j % int(step) == 0: |                     #        if j % int(step) == 0: | ||||||
|                                 e_list.append(j) |                     #            e_list.append(j) | ||||||
|                     except NameError: |                     #except NameError: | ||||||
|                         for j in range(int(low), int(high) + 1): |                     #    for j in range(int(low), int(high) + 1): | ||||||
|                             if j % int(step) == 0: |                     #        if j % int(step) == 0: | ||||||
|                                 e_list.append(j) |                     #            e_list.append(j) | ||||||
|                 else: |                 else: | ||||||
|                     if not star_or_int_re.search(t): |                     if not star_or_int_re.search(t): | ||||||
|                         t = self.ALPHACONV[i][t.lower()] |                         t = self.ALPHACONV[i][t.lower()] | ||||||
|   | |||||||
| @@ -92,9 +92,13 @@ class CroniterTest(base.TestCase): | |||||||
|         base = datetime(2010, 2, 24, 12, 9) |         base = datetime(2010, 2, 24, 12, 9) | ||||||
|         itr = croniter('0 0 */3 * *', base) |         itr = croniter('0 0 */3 * *', base) | ||||||
|         n1 = itr.get_next(datetime) |         n1 = itr.get_next(datetime) | ||||||
|         self.assertEqual(n1.day, 27) |         # 1 4 7 10 13 16 19 22 25 28 | ||||||
|  |         self.assertEqual(n1.day, 25) | ||||||
|         n2 = itr.get_next(datetime) |         n2 = itr.get_next(datetime) | ||||||
|         self.assertEqual(n2.day, 3) |         self.assertEqual(n2.day, 28) | ||||||
|  |         n3 = itr.get_next(datetime) | ||||||
|  |         self.assertEqual(n3.day, 1) | ||||||
|  |         self.assertEqual(n3.month, 3) | ||||||
|  |  | ||||||
|         # test leap year |         # test leap year | ||||||
|         base = datetime(1996, 2, 27) |         base = datetime(1996, 2, 27) | ||||||
| @@ -254,9 +258,12 @@ class CroniterTest(base.TestCase): | |||||||
|         base = datetime(2012, 2, 24) |         base = datetime(2012, 2, 24) | ||||||
|         itr = croniter('5 0 */2 * *', base) |         itr = croniter('5 0 */2 * *', base) | ||||||
|         n1 = itr.get_prev(datetime) |         n1 = itr.get_prev(datetime) | ||||||
|         self.assertEqual(n1.day, 22) |  | ||||||
|         self.assertEqual(n1.hour, 0) |         self.assertEqual(n1.hour, 0) | ||||||
|         self.assertEqual(n1.minute, 5) |         self.assertEqual(n1.minute, 5) | ||||||
|  |         self.assertEqual(n1.month, 2) | ||||||
|  |         # month starts from 1, 3 .... then 21, 23 | ||||||
|  |         # so correct is not 22  but 23 | ||||||
|  |         self.assertEqual(n1.day, 23) | ||||||
|  |  | ||||||
|     def testBug2(self): |     def testBug2(self): | ||||||
|         base = datetime(2012, 1, 1, 0, 0) |         base = datetime(2012, 1, 1, 0, 0) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mathieu Le Marec - Pasquet
					Mathieu Le Marec - Pasquet