def test_isValid(): bx = recipeReader.bsmxStages(simpleBsmx(), ctrlBsmxList()) assert bx.getRecipeName() == "18 Rune Stone IPA 2.5G" assert not bx.isValid() cx = recipeReader.bsmxStages(elaborateBsmx(), ctrl.setupControllers(False, True, True)) assert not cx.isValid() cp = os.path.dirname(__file__) print cp rp = cp + "/../../beersmith/18RuneStoneIPA.bsmx" print rp dx = recipeReader.bsmxStages(rp, ctrl.setupControllers(False, True, True)) assert dx.isValid() print myname(), "OK"
def test_GoodRecipe(): print(os.getcwd()) e = equipment.allEquipment('src/equipment/*.yaml') myequipment = e.get('Grain 3G, 5Gcooler, 5Gpot') bx = recipeReader.bsmxStages(goodRecipe(), ctrl.setupControllers(False, True, True, myequipment)) assert bx.isValid() print myname(), "OK"
def test_isValid(): bx = recipeReader.bsmxStages(simpleBsmx(), ctrlBsmxList()) assert bx.getRecipeName() == "18 Rune Stone IPA 2.5G" assert not bx.isValid() print(os.getcwd()) e = equipment.allEquipment('src/equipment/*.yaml') myequipment = e.get('Grain 2.5G, 5Gcooler, 4Gpot') cx = recipeReader.bsmxStages(elaborateBsmx(), ctrl.setupControllers(False, True, True, myequipment)) assert not cx.isValid() cp = os.path.dirname(__file__) print cp rp = cp + "/../../beersmith/18RuneStoneIPA.bsmx" print rp dx = recipeReader.bsmxStages(rp, ctrl.setupControllers(False, True, True, myequipment)) assert dx.isValid() print myname(), "OK"
def test_badTunDeadSpace(): bx = recipeReader.bsmxStages(badTunDeadSpaceBsmx(), ctrl.setupControllers(False, True, True)) print bx.getTunDeadSpace() print bx.getRecipeName() print bx.isValid() assert not bx.isValid() print str(bx.getStages()) print myname(), "OK"
def test_badTunDeadSpace(): print(os.getcwd()) e = equipment.allEquipment('src/equipment/*.yaml') myequipment = e.get('Grain 3G, 5Gcooler, 5Gpot, platechiller') bx = recipeReader.bsmxStages(badTunDeadSpaceBsmx(), ctrl.setupControllers(False, True, True, myequipment)) print bx.getTunDeadSpace() print bx.getRecipeName() print bx.isValid() assert not bx.isValid() print str(bx.getStages()) print myname(), "OK"
def testOneFullBSMX(): rl = getTestRecipeList() controllers = ctrl.setupControllers(False, True, True) assert len(rl.getNameList()) > 0 print "Number of recipes:", len(rl.getNameList()) recipeObj = rl.getRecipe('17 Falconers Flight IPA') recipeBSMX = recipeObj.getBSMXstring() print recipeBSMX recipeObjParsed = recipeReader.bsmxStages(recipeBSMX, controllers) print recipeObjParsed.getEquipment() s = recipeObjParsed.getStages() assert(s != {}) assert len(s) > 0 assert(recipeObjParsed.isValid()) print myname(), "OK"
def testOneFullBSMX(): rl = getTestRecipeList() print(os.getcwd()) e = equipment.allEquipment('src/equipment/*.yaml') myequipment = e.get('Grain 2.5G, 5Gcooler, 4Gpot') controllers = ctrl.setupControllers(False, True, True, myequipment) assert len(rl.getNameList()) > 0 print "Number of recipes:", len(rl.getNameList()) recipeObj = rl.getRecipe('17 Falconers Flight IPA') recipeBSMX = recipeObj.getBSMXstring() print recipeBSMX recipeObjParsed = recipeReader.bsmxStages(recipeBSMX, controllers) print recipeObjParsed.getEquipment() s = recipeObjParsed.getStages() assert(s != {}) assert len(s) > 0 assert(recipeObjParsed.isValid()) print myname(), "OK"
def setUp(self): p = helpers.findPort() server = webctrl.myserver.myserver(host="localhost", port=p) server.quiet = True controllers = ctrl.setupControllers(False, True, True) self.brewme = webctrl.runbrew( controllers, helpers.getTestRecipeList(), server) self.brewme.startNonBlocking() print "up and running" if VIRTUALDISPLAY: self.vdisplay = Xvfb(width=1280, height=720) self.vdisplay.start() self.driver = webdriver.Firefox() self.driver.implicitly_wait(30) self.base_url = "http://localhost:%i" % p self.verificationErrors = [] self.accept_next_alert = True
optret['outputfile'] = None for opt, arg in options: if opt in ('-h', '--help'): usage() if opt in ('-i', '--inputfile'): optret['inputfile'] = arg if opt in ('-o', '--outputfile'): optret['outputfile'] = arg elif opt in ('-v', '--verbose'): optret['verbose'] = True return(optret) if __name__ == "__main__": options = getOptions() controllers = ctrl.setupControllers(False, True, True) if options['inputfile'] is None: inf = sys.stdin else: try: inf = open(options['inputfile'], 'r') except: print "Can not open inputfile" sys.exit(1) if options['outputfile'] is None: outf = sys.stdout else: try: outf = open(options['outputfile'], 'w') except: print "Can not open outputfile", options['outputfile']
elif opt in ('-p', '--printRecipe'): printRecipe = True elif opt in ('-e', '--equipment'): HWcheck = True elif opt in ('-v', '--verbose'): verbose = True elif opt == '--version': version = arg stages = {} recipeName = "" if HWcheck: simulation = (simulation or (not HWcheck)) else: simulation = False controllers = ctrl.setupControllers(verbose, simulation, permissive) if HWcheck: if controllers.HWOK(): logging.info('USB devices connected') else: logging.info('ERROR: Missing USB devices, exiting') sys.exit(1) # Read one of the recipe files if recipeFile != "": j = recipeReader.jsonStages(recipeFile, controllers) if not j.isValid(): logging.error("Error: bad json recipe") else: recipeName = j.getRecipeName()
if opt in ('-i', '--inputfile'): optret['inputfile'] = arg if opt in ('-o', '--outputfile'): optret['outputfile'] = arg elif opt in ('-v', '--verbose'): optret['verbose'] = True return(optret) if __name__ == "__main__": options = getOptions() mypath = os.path.dirname(os.path.realpath(__file__)) e = equipment.allEquipment(mypath + '/equipment/*.yaml') myequipment = e.get('Grain 3G, 5Gcooler, 5Gpot, platechiller') print(myequipment) controllers = ctrl.setupControllers(False, True, True, myequipment) if options['inputfile'] is None: inf = sys.stdin else: try: inf = open(options['inputfile'], 'r') except: print "Can not open inputfile" sys.exit(1) if options['outputfile'] is None: outf = sys.stdout else: try: outf = open(options['outputfile'], 'w') except: print "Can not open outputfile", options['outputfile']
inf.close() try: e = xml.etree.ElementTree.fromstring(bsmxStr) except: logging.error('Can not parse file: {}'.format(bsmxFile)) equipmentName = e.find('Data').find('Recipe').find('F_R_EQUIPMENT').find('F_E_NAME').text myEquipment = availableEquipment.get(equipmentName) if myEquipment is None: logging.error('Selected equipment is not available') sys.exit(1) else: # This may have to change to AllNoLimit myEquipment = availableEquipment.get('Grain 3G, 5Gcooler, 5Gpot, platechiller') logging.info('Equipment: {}'.format(myEquipment['equipmentName'])) controllers = ctrl.setupControllers(verbose, simulation, permissive, myEquipment) if controllers is None: logging.error('No controllers') sys.exit(1) if HWcheck: if controllers.HWOK(): logging.info('USB devices connected') else: logging.info('ERROR: Missing USB devices, exiting') sys.exit(1) # Read one of the recipe files if recipeFile != "": j = recipeReader.jsonStages(recipeFile, controllers) if not j.isValid():
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO, stream=sys.stdout) logging.warning('warning test') logging.info('Starting...') options = getOptions() e = equipment.allEquipment('equipment/*.yaml') if options['equipmentType']: myequipment = e.get(options['equipmentType']) else: myequipment = e.get('Grain 3G, 5Gcooler, 5Gpot, platechiller') controllers = ctrl.setupControllers(options['verbose'], False, True, myequipment) if options['HWcheck']: if controllers.HWOK(): print "HW OK" else: print "ERROR: HW not OK, exiting" sys.exit(1) recipelist = readRecipeFile(controllers, options['bsmxfile'], options['user']) if recipelist is None: print "Error: No recipes" sys.exit(1) # Start daemon loop
#rl.nameListToMemcache() return(rl) if __name__ == "__main__": logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO, stream=sys.stdout) logging.warning('warning test') logging.info('Starting...') options = getOptions() controllers = ctrl.setupControllers(options['verbose'], False, True) if options['HWcheck']: if controllers.HWOK(): print "HW OK" else: print "ERROR: HW not OK, exiting" sys.exit(1) recipelist = readRecipeFile(controllers, options['bsmxfile'], options['user']) if recipelist is None: print "Error: No recipes" sys.exit(1) # Start daemon loop
def test_GoodRecipe(): bx = recipeReader.bsmxStages(goodRecipe(), ctrl.setupControllers(False, True, True)) assert bx.isValid() print myname(), "OK"