Permalink
Browse files

Merge pull request #7 from hgdeoro/fix_validationerror_doesnt_exists

Changed ValidationError to ValueError
  • Loading branch information...
2 parents 521402f + 17f7938 commit 1b6ad78e9cba168d4ca32cc78f200f608cecba4b @coleifer committed Sep 29, 2012
Showing with 7 additions and 2 deletions.
  1. +2 −2 huey/decorators.py
  2. +5 −0 huey/tests/crontab.py
View
@@ -120,15 +120,15 @@ def crontab(month='*', day='*', day_of_week='*', hour='*', minute='*'):
if piece.isdigit():
piece = int(piece)
if piece not in acceptable:
- raise ValidationError('%d is not a valid input' % piece)
+ raise ValueError('%d is not a valid input' % piece)
settings.add(piece)
else:
dash_match = dash_re.match(piece)
if dash_match:
lhs, rhs = map(int, dash_match.groups())
if lhs not in acceptable or rhs not in acceptable:
- raise ValidationError('%s is not a valid input' % piece)
+ raise ValueError('%s is not a valid input' % piece)
settings.update(range(lhs, rhs+1))
continue
@@ -84,3 +84,8 @@ def test_crontab_all_together(self):
# fails validation on minute
self.assertFalse(validate(datetime.datetime(2011, 1, 1, 4, 6)))
+
+ def test_invalid_crontabs(self):
+ # check invalid configurations are detected and reported
+ self.assertRaises(ValueError, crontab, minute='61')
+ self.assertRaises(ValueError, crontab, minute='0-61')

0 comments on commit 1b6ad78

Please sign in to comment.