From 98e3a56296cb9955e49adb09a111f26e07328338 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 30 Mar 2020 11:56:05 +0300 Subject: project.ci: dedupe code --- project/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'project/utils.py') diff --git a/project/utils.py b/project/utils.py index 68327af..5874eab 100644 --- a/project/utils.py +++ b/project/utils.py @@ -74,3 +74,9 @@ def temp_file(contents, **kwargs): file.write(contents) with delete(path): yield path + + +def env(name): + if name not in os.environ: + raise RuntimeError(f'undefined environment variable: {name}') + return os.environ[name] -- cgit v1.2.3