mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-08 16:22:38 +08:00
Switch deploy-environment value convention from underscores to dashes
Default value is now 'local-git' (was 'local_git'). Dashes are easier to type and more conventional in HTTP-header-adjacent identifiers. Tests updated accordingly. Amp-Thread-ID: https://ampcode.com/threads/T-019df26e-96f4-7518-94da-0e4263680e3c Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
parent
22186b3dae
commit
2001646f78
@ -6,7 +6,7 @@ import folder_paths
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
_DEFAULT_DEPLOY_ENV = "local_git"
|
_DEFAULT_DEPLOY_ENV = "local-git"
|
||||||
_ENV_FILENAME = ".comfy_environment"
|
_ENV_FILENAME = ".comfy_environment"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,27 +26,27 @@ def _write_env_file(tmp_path, content: str) -> str:
|
|||||||
|
|
||||||
class TestGetDeployEnvironment:
|
class TestGetDeployEnvironment:
|
||||||
def test_returns_local_git_when_file_missing(self):
|
def test_returns_local_git_when_file_missing(self):
|
||||||
assert get_deploy_environment() == "local_git"
|
assert get_deploy_environment() == "local-git"
|
||||||
|
|
||||||
def test_reads_value_from_file(self, tmp_path):
|
def test_reads_value_from_file(self, tmp_path):
|
||||||
_write_env_file(tmp_path, "local_desktop2_standalone\n")
|
_write_env_file(tmp_path, "local-desktop2-standalone\n")
|
||||||
assert get_deploy_environment() == "local_desktop2_standalone"
|
assert get_deploy_environment() == "local-desktop2-standalone"
|
||||||
|
|
||||||
def test_strips_trailing_whitespace_and_newline(self, tmp_path):
|
def test_strips_trailing_whitespace_and_newline(self, tmp_path):
|
||||||
_write_env_file(tmp_path, " local_desktop2_standalone \n")
|
_write_env_file(tmp_path, " local-desktop2-standalone \n")
|
||||||
assert get_deploy_environment() == "local_desktop2_standalone"
|
assert get_deploy_environment() == "local-desktop2-standalone"
|
||||||
|
|
||||||
def test_only_first_line_is_used(self, tmp_path):
|
def test_only_first_line_is_used(self, tmp_path):
|
||||||
_write_env_file(tmp_path, "first_line\nsecond_line\n")
|
_write_env_file(tmp_path, "first-line\nsecond-line\n")
|
||||||
assert get_deploy_environment() == "first_line"
|
assert get_deploy_environment() == "first-line"
|
||||||
|
|
||||||
def test_empty_file_falls_back_to_default(self, tmp_path):
|
def test_empty_file_falls_back_to_default(self, tmp_path):
|
||||||
_write_env_file(tmp_path, "")
|
_write_env_file(tmp_path, "")
|
||||||
assert get_deploy_environment() == "local_git"
|
assert get_deploy_environment() == "local-git"
|
||||||
|
|
||||||
def test_empty_after_whitespace_strip_falls_back_to_default(self, tmp_path):
|
def test_empty_after_whitespace_strip_falls_back_to_default(self, tmp_path):
|
||||||
_write_env_file(tmp_path, " \n")
|
_write_env_file(tmp_path, " \n")
|
||||||
assert get_deploy_environment() == "local_git"
|
assert get_deploy_environment() == "local-git"
|
||||||
|
|
||||||
def test_strips_control_chars_within_first_line(self, tmp_path):
|
def test_strips_control_chars_within_first_line(self, tmp_path):
|
||||||
# Embedded NUL/control chars in the value should be stripped
|
# Embedded NUL/control chars in the value should be stripped
|
||||||
@ -80,4 +80,4 @@ class TestGetDeployEnvironment:
|
|||||||
raise OSError("simulated read failure")
|
raise OSError("simulated read failure")
|
||||||
|
|
||||||
monkeypatch.setattr("builtins.open", _boom)
|
monkeypatch.setattr("builtins.open", _boom)
|
||||||
assert get_deploy_environment() == "local_git"
|
assert get_deploy_environment() == "local-git"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user