1+ import platform
2+
13import pytest
24
35from birdnet .acoustic_models .v2_4 .tf import AcousticTFDownloaderV2_4
@@ -21,10 +23,8 @@ def test_load_tf_and_litert_after_each_other_is_not_possible() -> None:
2123 assert model_tf is not None
2224
2325 # Loading Litert model after TF fails
24- with pytest .raises (
25- ImportError ,
26- match = r"generic_type: type \"InterpreterWrapper\" is already registered!" ,
27- ):
26+ # Error message differs between platforms
27+ with pytest .raises (ImportError ):
2828 load_tf_model (model_path , library = "litert" , allocate_tensors = False )
2929
3030
@@ -41,5 +41,11 @@ def test_load_litert_and_tf_after_each_other_is_possible() -> None:
4141 assert model_litert is not None
4242
4343 # Load TF model
44- model_tf = load_tf_model (model_path , library = "tf" , allocate_tensors = False )
45- assert model_tf is not None
44+ # on macOS it can't be loaded after liteRT
45+ if platform .system () == "Darwin" :
46+ # Loading Litert model after TF fails
47+ with pytest .raises (ImportError ):
48+ load_tf_model (model_path , library = "tf" , allocate_tensors = False )
49+ else :
50+ model_tf = load_tf_model (model_path , library = "tf" , allocate_tensors = False )
51+ assert model_tf is not None
0 commit comments