amplegest / tests /test_runtime_env.py
Viney's picture
fix: commit missing dashboard.runtime_env module used by app.py
d5257f7
Raw
History Blame Contribute Delete
663 Bytes
from dashboard.runtime_env import is_hosted_space
def test_is_hosted_space_false_without_hf_environment(monkeypatch):
monkeypatch.delenv("SYSTEM", raising=False)
monkeypatch.delenv("SPACE_ID", raising=False)
assert is_hosted_space() is False
def test_is_hosted_space_true_for_spaces_system(monkeypatch):
monkeypatch.setenv("SYSTEM", "spaces")
monkeypatch.delenv("SPACE_ID", raising=False)
assert is_hosted_space() is True
def test_is_hosted_space_true_when_space_id_is_defined(monkeypatch):
monkeypatch.delenv("SYSTEM", raising=False)
monkeypatch.setenv("SPACE_ID", "Viney/amplegest")
assert is_hosted_space() is True