Skip to content

Commit

Permalink
Merge branch 'release-v5.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
looselycoupled committed Jun 29, 2020
2 parents 02a0e4e + abfdf3b commit 69c50ed
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion btrdb/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def from_timedelta(cls, delta):
specified duration. Because pointwidths are in powers of 2, be sure to check
that the returned real duration is sufficient.
"""
return cls.from_nanoseconds(delta.total_seconds()*1e9)
return cls.from_nanoseconds(int(delta.total_seconds()*1e9))

@classmethod
def from_nanoseconds(cls, nsec):
Expand Down
4 changes: 2 additions & 2 deletions btrdb/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
__version_info__ = {
'major': 5,
'minor': 8,
'micro': 0,
'micro': 1,
'releaselevel': 'final',
'serial': 13,
'serial': 14,
}

##########################################################################
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GRPC / Protobuff related
grpcio==1.16.1
grpcio-tools==1.16.1
grpcio>=1.16.1
grpcio-tools>=1.16.1

# Time related utils
pytz
Expand Down
2 changes: 1 addition & 1 deletion tests/btrdb/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
## Test Constants
##########################################################################

EXPECTED_VERSION = "5.8"
EXPECTED_VERSION = "5.8.1"


##########################################################################
Expand Down
14 changes: 8 additions & 6 deletions tests/btrdb/utils/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ class TestPointwidth(object):
(timedelta(days=30), 51),
(timedelta(days=7), 49),
(timedelta(days=1), 46),
(timedelta(hours=4), 45),
(timedelta(minutes=15), 40),
(timedelta(seconds=30), 29),
(timedelta(hours=4), 43),
(timedelta(minutes=15), 39),
(timedelta(seconds=30), 34),
])
def test_from_nanoseconds(self, delta, expected):

def test_from_timedelta(self, delta, expected):
"""
Test getting the closest point width from nanoseconds
Test getting the closest point width from a timedelta
"""
assert pointwidth.from_nanoseconds(nsec) == expected
assert pointwidth.from_timedelta(delta) == expected

@pytest.mark.parametrize("nsec, expected", [
(ns_delta(days=365), 54),
Expand All @@ -44,6 +45,7 @@ def test_from_nanoseconds(self, delta, expected):
(ns_delta(minutes=30), 40),
(ns_delta(seconds=1), 29),
])

def test_from_nanoseconds(self, nsec, expected):
"""
Test getting the closest point width from nanoseconds
Expand Down

0 comments on commit 69c50ed

Please sign in to comment.