def make_db(self): mydb = mysql.connector.connect( host="localhost", user="******", passwd="ep513140", database="motordb", ) cursor = mydb.cursor(buffered=True) cursor.execute("USE motordb") motor = StatusAxis(name = 'testMotor') motor.prefix = 'prefix' det = SynGauss('det', motor, 'testMotor', center=0, Imax=1, sigma=1) det.kind = 'hinted' wh = waitingHook() mydb.commit() RE = RunEngine() RE.waiting_hook = wh RE(scan([], motor, 1, 3, 3)) time.sleep(2) mydb.commit() return mydb
def class_db(request): print("here") mydb = mysql.connector.connect( host=os.environ['MYSQL_HOST'], user=os.environ['MYSQL_USER'], passwd=os.environ['MYSQL_PASSWORD'], database=os.environ['MYSQL_DB'], ) cursor = mydb.cursor(buffered=True) motor = StatusAxis(name = 'testMotor') motor.prefix = 'prefix' det = SynGauss('det', motor, 'testMotor', center=0, Imax=1, sigma=1) det.kind = 'hinted' wh = waitingHook() mydb.commit() RE = RunEngine() RE.waiting_hook = wh RE(scan([], motor, 1, 3, 3)) time.sleep(2) mydb.commit() request.cls.db = mydb
from bluesky import RunEngine from bluesky.plans import scan from bluesky.callbacks.best_effort import BestEffortCallback from ophyd.sim import SynGauss from status import StatusAxis # Create simulated devices motor = StatusAxis(name='motor') det = SynGauss('det', motor, 'motor', center=0, Imax=1, sigma=1) det.kind = 'hinted' motor.prefix = 'fake:Prefix' # Create our RunEngine RE = RunEngine() RE.subscribe(BestEffortCallback())