Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_validation(self, env, set_env):
set_env({"INT": "invalid", "DTIME": "notadatetime"})
env.int("INT")
env.datetime("DTIME")
env.str("REQUIRED")
with pytest.raises(environs.EnvValidationError) as excinfo:
env.seal()
exc = excinfo.value
msg = exc.args[0]
assert "REQUIRED" in msg
assert "INT" in msg
assert "DTIME" in msg
assert "REQUIRED" in exc.error_messages
assert "INT" in exc.error_messages
assert "DTIME" in exc.error_messages