You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mosquitto/test/broker/mosq_test_helper.py

32 lines
807 B
Python

import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
sys.path.insert(0, cmd_subfolder)
import mosq_test
import mqtt5_opts
import mqtt5_props
import mqtt5_rc
import socket
import ssl
import struct
import subprocess
import time
import errno
from pathlib import Path
source_dir = Path(__file__).resolve().parent
ssl_dir = source_dir.parent / "ssl"
import importlib
def persist_module():
if len(sys.argv) > 1:
mod = sys.argv.pop(1)
else:
raise RuntimeError("Not enough command line arguments - need persist module")
return importlib.import_module(mod)