Skip to content

Commit

Permalink
Forcing UTC datetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
Psykopear committed Sep 21, 2022
1 parent 14ea8ac commit 0cf8971
Show file tree
Hide file tree
Showing 10 changed files with 313 additions and 795 deletions.
558 changes: 234 additions & 324 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ python-source = "pysrc"
[dependencies]
bincode = { version = "1.3.3" }
chrono = { version = "0.4", features = [ "serde" ] }
chrono-tz = { version = "0.6", features = ["serde"] }
futures = { version = "0.3.21" }
log = { version = "0.4" }
pyo3 = { git = "https://github.com/psykopear/pyo3", branch = "chrono", version = "0.17" }
pyo3 = { git = "https://github.com/psykopear/pyo3", branch = "chrono", version = "0.17", features = ["macros", "chrono"] }
# pyo3-log = { version = "0.7" }
rdkafka = { version = "0.28.0", features = [ "cmake-build" ] }
scopeguard = { version = "1.1.0" }
Expand All @@ -28,7 +27,7 @@ timely = { version = "0.12.0", features = [ "bincode" ] }
tokio = { version = "1.20.1", features = [ "full" ] }

[dev-dependencies]
pyo3 = { git = "https://github.com/psykopear/pyo3", branch = "chrono", version = "0.17", default-features = false }
pyo3 = { git = "https://github.com/psykopear/pyo3", branch = "chrono", version = "0.17", default-features = false, features = ["macros", "chrono"] }

[features]
extension-module = ["pyo3/extension-module"]
Expand Down
166 changes: 0 additions & 166 deletions pytests/test_datetime.py

This file was deleted.

8 changes: 5 additions & 3 deletions pytests/test_window.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import defaultdict
from datetime import timedelta, datetime
from datetime import timedelta, datetime, timezone

from bytewax.dataflow import Dataflow
from bytewax.execution import run_main
Expand All @@ -17,7 +17,8 @@ def gen():

flow.input("inp", TestingInputConfig(gen()))

start_at = datetime(2022, 1, 1)
# Only utc datetime is accepted as the `start_at` parameter
start_at = datetime(2022, 1, 1, tzinfo=timezone.utc)
# This will result in times for events of +0, +4, +8, +12.
clock_config = TestingClockConfig(item_incr=timedelta(seconds=4), start_at=start_at)
# And since the window is +10, we should get a window with value
Expand Down Expand Up @@ -61,7 +62,8 @@ def count(results, event):
results[event["type"]] += 1
return results

start_at = datetime(2022, 1, 1)
# Only utc datetime is accepted as the `start_at` parameter
start_at = datetime(2022, 1, 1, tzinfo=timezone.utc)
# This will result in times for events of +0, +4, +8, +12.
clock_config = TestingClockConfig(
item_incr=timedelta(seconds=4), start_at=start_at
Expand Down

0 comments on commit 0cf8971

Please sign in to comment.