Repository: sloria/environs

Issue:
Add time parser
marshmallow has a `Time` field, so there should be a corresponding parser for it.

Discussion:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78b0eef..7eb9d2e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
 # Changelog
 
+## 9.2.0 (unreleased)
+
+Features:
+
+- Add time parser ([#191](https://github.com/sloria/environs/issues/191)).
+
 ## 9.1.0 (2020-11-06)
 
 Features:
diff --git a/environs/__init__.py b/environs/__init__.py
index 5faa951..9c53bfc 100644
--- a/environs/__init__.py
+++ b/environs/__init__.py
@@ -291,6 +291,7 @@ class Env:
     json = _field2method(ma.fields.Field, "json", preprocess=_preprocess_json)
     datetime = _field2method(ma.fields.DateTime, "datetime")
     date = _field2method(ma.fields.Date, "date")
+    time = _field2method(ma.fields.Time, "time")
     path = _field2method(PathField, "path")
     log_level = _field2method(LogLevelField, "log_level")
     timedelta = _field2method(ma.fields.TimeDelta, "timedelta")


Test patch:
diff --git a/tests/test_environs.py b/tests/test_environs.py
index c2451c5..3391f18 100644
--- a/tests/test_environs.py
+++ b/tests/test_environs.py
@@ -174,6 +174,10 @@ class TestCasting:
         set_env({"TIMEDELTA": "42"})
         assert env.timedelta("TIMEDELTA") == dt.timedelta(seconds=42)
 
+    def test_time_cast(self, set_env, env):
+        set_env({"TIME": "10:30"})
+        assert env.time("TIME") == dt.time(hour=10, minute=30, second=0)
+
     def test_uuid_cast(self, set_env, env):
         uid = uuid.uuid1()
         set_env({"UUID": str(uid)})