Skip to content

Commit

Permalink
Fix timestamp-related test for Linux platform
Browse files Browse the repository at this point in the history
  • Loading branch information
elliptical committed Mar 5, 2021
1 parent 43041ec commit d3c33ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clot/torrent/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def extract_value(self, instance):
# the number of seconds elapsed since 1970-01-01 00:00:00 +0000 (UTC).
try:
return datetime.fromtimestamp(value, timezone.utc)
except (OverflowError, OSError) as ex:
except (OverflowError, OSError, ValueError) as ex:
raise ValueError(f'{self.name}: cannot convert {value!r} to a timestamp') from ex

def validate(self, value):
Expand Down
2 changes: 1 addition & 1 deletion test/torrent/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ class Dummy(Base):
class TimestampTestCase(tcm.TestCase):
@tcm.values(
(b'1', TypeError, "field: expected b'1' to be of type <class 'int'>"),
(100_000_000_000, ValueError, 'field: cannot convert 100000000000 to a timestamp'),
(300_000_000_000, ValueError, 'field: cannot convert 300000000000 to a timestamp'),
)
def test_bad_storage_will_raise_on_load(self, value, exception_type, expected_message):
class Dummy(Base):
Expand Down

0 comments on commit d3c33ee

Please sign in to comment.