Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #7 from hgdeoro/fix_validationerror_doesnt_exists

Changed ValidationError to ValueError
  • Loading branch information...
commit 1b6ad78e9cba168d4ca32cc78f200f608cecba4b 2 parents 521402f + 17f7938
@coleifer authored
Showing with 7 additions and 2 deletions.
  1. +2 −2 huey/decorators.py
  2. +5 −0 huey/tests/crontab.py
View
4 huey/decorators.py
@@ -120,7 +120,7 @@ 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:
@@ -128,7 +128,7 @@ def crontab(month='*', day='*', day_of_week='*', hour='*', minute='*'):
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
View
5 huey/tests/crontab.py
@@ -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')
Please sign in to comment.
Something went wrong with that request. Please try again.