Drop support for python 3.7, add python 3.12-dev by theskumar · Pull Request #449 · theskumar/python-dotenv
Expand Up
@@ -153,61 +153,61 @@ def test_set_no_file(cli):
def test_get_default_path(tmp_path): sh.cd(str(tmp_path)) with open(str(tmp_path / ".env"), "w") as f: f.write("a=b") with sh.pushd(str(tmp_path)): with open(str(tmp_path / ".env"), "w") as f: f.write("a=b")
result = sh.dotenv("get", "a") result = sh.dotenv("get", "a")
assert result == "b\n" assert result == "b\n"
def test_run(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b")
result = sh.dotenv("run", "printenv", "a") result = sh.dotenv("run", "printenv", "a")
assert result == "b\n" assert result == "b\n"
def test_run_with_existing_variable(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"}) with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"})
result = sh.dotenv("run", "printenv", "a", _env=env) result = sh.dotenv("run", "printenv", "a", _env=env)
assert result == "b\n" assert result == "b\n"
def test_run_with_existing_variable_not_overridden(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"}) with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"})
result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env) result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env)
assert result == "c\n" assert result == "c\n"
def test_run_with_none_value(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b\nc") with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b\nc")
result = sh.dotenv("run", "printenv", "a") result = sh.dotenv("run", "printenv", "a")
assert result == "b\n" assert result == "b\n"
def test_run_with_other_env(dotenv_file): Expand Down
def test_get_default_path(tmp_path): sh.cd(str(tmp_path)) with open(str(tmp_path / ".env"), "w") as f: f.write("a=b") with sh.pushd(str(tmp_path)): with open(str(tmp_path / ".env"), "w") as f: f.write("a=b")
result = sh.dotenv("get", "a") result = sh.dotenv("get", "a")
assert result == "b\n" assert result == "b\n"
def test_run(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b")
result = sh.dotenv("run", "printenv", "a") result = sh.dotenv("run", "printenv", "a")
assert result == "b\n" assert result == "b\n"
def test_run_with_existing_variable(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"}) with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"})
result = sh.dotenv("run", "printenv", "a", _env=env) result = sh.dotenv("run", "printenv", "a", _env=env)
assert result == "b\n" assert result == "b\n"
def test_run_with_existing_variable_not_overridden(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"}) with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b") env = dict(os.environ) env.update({"LANG": "en_US.UTF-8", "a": "c"})
result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env) result = sh.dotenv("run", "--no-override", "printenv", "a", _env=env)
assert result == "c\n" assert result == "c\n"
def test_run_with_none_value(tmp_path): sh.cd(str(tmp_path)) dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b\nc") with sh.pushd(str(tmp_path)): dotenv_file = str(tmp_path / ".env") with open(dotenv_file, "w") as f: f.write("a=b\nc")
result = sh.dotenv("run", "printenv", "a") result = sh.dotenv("run", "printenv", "a")
assert result == "b\n" assert result == "b\n"
def test_run_with_other_env(dotenv_file): Expand Down