X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=near-rt-ric-simulator%2Ftests%2Funittest_setup.py;h=e30b1adc5e6b24f837e2a6241ea758d8f081f3a4;hb=3c47934969cb887007ad96d71906598a9a4bf0cc;hp=0dbbd22cc2dcf420e68d1915f6bd289124051817;hpb=868107297d275a6f50790a5e6d3de6c65cbd4a3e;p=sim%2Fa1-interface.git diff --git a/near-rt-ric-simulator/tests/unittest_setup.py b/near-rt-ric-simulator/tests/unittest_setup.py index 0dbbd22..e30b1ad 100644 --- a/near-rt-ric-simulator/tests/unittest_setup.py +++ b/near-rt-ric-simulator/tests/unittest_setup.py @@ -25,7 +25,7 @@ PORT_NUMBER="2222" HOST_IP="localhost" SERVER_URL="http://"+HOST_IP+":"+PORT_NUMBER+"/" -#Dir for json test data files +# Dir for json test data files testdata="" def setup_env(interface_version): @@ -40,6 +40,7 @@ def setup_env(interface_version): #Env var to setup version and host logging os.environ['APIPATH'] = cwd+"../api/"+interface_version os.environ['REMOTE_HOSTS_LOGGING'] = "ON" + os.environ['DUPLICATE_CHECK'] = "0" # Paths need to run the sim, including needed source file dirs sys.path.append(os.path.abspath(cwd+'../src/common')) @@ -50,9 +51,14 @@ def setup_env(interface_version): def get_testdata_dir(): return testdata -#Test client for rest calls +# Test client for rest calls @pytest.fixture def client(): from main import app - with app.app.test_client() as c: - yield c \ No newline at end of file + with app.app.test_client() as client: + yield client + +# Run the Flask app in a separate thread for testing +def run_flask_app(): + from main import app + app.app.run(port=8086, host="127.0.0.1")