예제 #1
0
def test_quickInit(tmpdir):
	p = tmpdir.mkdir("sub").join("blue.csv")
	curDate = time.strftime("%d_%m_%Y")
	filePathBlue = str(p) + curDate + "_" + "location_blue.csv"
	sd = SDfile(str(p), "location")
	sd.quickInit(filePathBlue)
	read = sd.quickRead(filePathBlue)
	expected = "ID,Location,Date,Time"
	assert read[0] == expected
예제 #2
0
def main():
	#a = append, r+ = read/write, w = write, r = read

	#Test using a class
	sensor2 = SDfile(SDfileRootPath, "Nest")
	#sensor2.quickInit(headers)
	#sensor2.quickAppend("3,nest,sept12,5:30pm" + '\n')
	#sensor2.quickAppend("4,nest,sept12,5:30pm" + '\n')
	#sensor2.quickAppend("4,nest,sept12,10:30pm" + '\n')
	sensor2.quickAppendBuffer(["black,panago,sept12,10:30pm", "green,pizzahut,sept12,10:30pm", "black,freshSlice,sept12,10:30pm"])
예제 #3
0
def test_isCurrentDate(tmpdir):
	p = tmpdir.mkdir("sub")
	sd = SDfile(str(p), "location")
	curDate = time.strftime("%d_%m_%Y")
	assert sd.isCurrentDate(curDate) == True
예제 #4
0
def test_setCurrentDate(tmpdir):
	p = tmpdir.mkdir("sub")
	sd = SDfile(str(p), "location")
	curDate = time.strftime("12_12_12")
	sd.setCurrentDate(curDate)
	assert sd.getCurrentDate() == curDate
예제 #5
0
    mainDeque = deque()
    
    #Init buffer
    location = raw_input('Please enter currect location of bin:')
    #location = str(main(sys.argv[1:]))
    binBuffer = Buffer(location, "black", "green", "blue", "grey")
    time.sleep(10)
    
    #Clean buffer
    binBuffer.clear()
    
    binEmptyFlag = True
    
    #Init sdFile
    #headers = "ID,Location,Date,Time"
    sdFile = SDfile(relativePath, location)
    #sdFile.quickInit(headers)

    #Init database
    db = Database("54.218.32.132", "bfguser", "bfg123", "bfg")
    
    #Init global variables
    globalVars.init()

    #Start display thread
    #displayThread = threading.Thread(target=Display.startDisplay)
    #displayThread.start()
    
    while True:
        if binBuffer.getEmptyFlag() == False:
            mainDeque = binBuffer.flushBuffer()