Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #7 from hgdeoro/fix_validationerror_doesnt_exists

Changed ValidationError to ValueError
  • Loading branch information...
commit 1b6ad78e9cba168d4ca32cc78f200f608cecba4b 2 parents 521402f + 17f7938
Charles Leifer authored September 29, 2012
4  huey/decorators.py
@@ -120,7 +120,7 @@ def crontab(month='*', day='*', day_of_week='*', hour='*', minute='*'):
120 120
             if piece.isdigit():
121 121
                 piece = int(piece)
122 122
                 if piece not in acceptable:
123  
-                    raise ValidationError('%d is not a valid input' % piece)
  123
+                    raise ValueError('%d is not a valid input' % piece)
124 124
                 settings.add(piece)
125 125
             
126 126
             else:
@@ -128,7 +128,7 @@ def crontab(month='*', day='*', day_of_week='*', hour='*', minute='*'):
128 128
                 if dash_match:
129 129
                     lhs, rhs = map(int, dash_match.groups())
130 130
                     if lhs not in acceptable or rhs not in acceptable:
131  
-                        raise ValidationError('%s is not a valid input' % piece)
  131
+                        raise ValueError('%s is not a valid input' % piece)
132 132
                     settings.update(range(lhs, rhs+1))
133 133
                     continue
134 134
                 
5  huey/tests/crontab.py
@@ -84,3 +84,8 @@ def test_crontab_all_together(self):
84 84
 
85 85
         # fails validation on minute
86 86
         self.assertFalse(validate(datetime.datetime(2011, 1, 1, 4, 6)))
  87
+
  88
+    def test_invalid_crontabs(self):
  89
+        # check invalid configurations are detected and reported
  90
+        self.assertRaises(ValueError, crontab, minute='61')
  91
+        self.assertRaises(ValueError, crontab, minute='0-61')

0 notes on commit 1b6ad78

Please sign in to comment.
Something went wrong with that request. Please try again.