test: update test for env var
CI / lint (pull_request) Successful in 20s
CI / test (3.11) (pull_request) Successful in 25s
CI / test (3.12) (pull_request) Successful in 25s
CI / test (3.13) (pull_request) Successful in 30s
CI / lint (push) Successful in 18s
Build and Publish / release (push) Successful in 19s
CI / test (3.12) (push) Successful in 24s
CI / test (3.11) (push) Successful in 33s
CI / test (3.13) (push) Successful in 27s

This commit was merged in pull request #6.
This commit is contained in:
2026-07-08 11:48:46 +02:00
parent 4ac9587abc
commit 3764c987b0
+11 -5
View File
@@ -1,14 +1,18 @@
import os
from unittest.mock import patch
from aarecommon.models.beamline import MXBeamline
import pytest
from aarecommon.config.beamline import mx_beamline
from aarecommon.models.beamline import MXBeamline
def test_mx_beamline_default():
with patch.dict(os.environ, {}, clear=True):
# If BEAMLINE is not set, it should return SIMULATED
assert mx_beamline() == MXBeamline.SIMULATED
with pytest.raises(ValueError) as e:
# If BEAMLINE is not set, it should raise
mx_beamline()
assert e.match("set the BEAMLINE")
def test_mx_beamline_x10sa():
@@ -22,5 +26,7 @@ def test_mx_beamline_x06sa():
def test_mx_beamline_invalid():
with patch.dict(os.environ, {"BEAMLINE": "INVALID"}):
assert mx_beamline() == MXBeamline.SIMULATED
with pytest.raises(ValueError) as e:
with patch.dict(os.environ, {"BEAMLINE": "INVALID"}):
mx_beamline()
assert e.match("not a valid value")