Skip to content

Commit

Permalink
test: Add test for platform localization
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Sep 19, 2024
1 parent 9a889b4 commit 26df7f2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from qibolab._core.native import SingleQubitNatives, TwoQubitNatives
from qibolab._core.parameters import NativeGates, Parameters, update_configs
from qibolab._core.platform import Platform
from qibolab._core.platform.load import PLATFORM, PLATFORMS
from qibolab._core.platform.load import PLATFORM, PLATFORMS, locate_platform
from qibolab._core.platform.platform import PARAMETERS
from qibolab._core.pulses import Delay, Gaussian, Pulse, Rectangular
from qibolab._core.sequence import PulseSequence
Expand Down Expand Up @@ -67,6 +67,24 @@ def test_platform_basics():
assert (1, 6) in platform2.pairs


def test_locate_platform(tmp_path: Path):
some = tmp_path / "some"
some.mkdir()

for p in [some / "platform0", some / "platform1"]:
p.mkdir()
(p / PLATFORM).write_text("'Ciao'")

assert locate_platform("platform0", [some]) == some / "platform0"

with pytest.raises(ValueError):
locate_platform("platform3")

os.environ[PLATFORMS] = str(some)

assert locate_platform("platform1") == some / "platform1"


def test_create_platform_multipath(tmp_path: Path):
some = tmp_path / "some"
others = tmp_path / "others"
Expand Down

0 comments on commit 26df7f2

Please sign in to comment.