1 # ==================================================================================
2 # Copyright (c) 2020 Nokia
3 # Copyright (c) 2020 AT&T Intellectual Property.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ==================================================================================
19 from ricxappframe.rmr.exceptions import InitFailed
20 from ricxappframe.xapp_frame import Xapp, RMRXapp
24 """test that an xapp whose rmr fails to init blows up"""
29 with pytest.raises(InitFailed):
30 bad_xapp = Xapp(entrypoint=entry, rmr_port=-1)
31 bad_xapp.run() # we wont get here
36 with pytest.raises(InitFailed):
37 bad_xapp = RMRXapp(default_handler=defh, rmr_port=-1)
38 bad_xapp.run() # we wont get here
41 def test_init_general_xapp():
43 # normally we would have some kind of loop here
46 gen_xapp = Xapp(entrypoint=entry, rmr_wait_for_ready=False, use_fake_sdl=True)
49 gen_xapp.stop() # pytest will never return without this.
52 def test_init_rmr_xapp():
56 def foo(self, _summary, _sbuf):
59 rmr_xapp = RMRXapp(foo, post_init=post_init, rmr_wait_for_ready=False, use_fake_sdl=True)
60 # pytest will never return without thread and stop
61 rmr_xapp.run(thread=True)