#NEWLINE# def test_basic( tmpdir ) : #NEWLINE# #INDENT# tmpfile = os . path . join ( str ( tmpdir ) , 'basic' ) #NEWLINE# handler = state . StateHandler ( test_path ) #NEWLINE# num = random . randint ( 0 , 100 ) #NEWLINE# item = { #NEWLINE# #INDENT# 'tmpfile' : tmpfile , #NEWLINE# 'num' : num , #NEWLINE# #UNINDENT# } #NEWLINE# failed = handler . apply ( 'test1' , [ item ] , True ) #NEWLINE# assert ( len ( failed ) == 1 ) #NEWLINE# assert ( failed [ 0 ] == item ) #NEWLINE# failed = handler . apply ( 'test1' , [ item ] ) #NEWLINE# assert ( len ( failed ) == 0 ) #NEWLINE# with open ( tmpfile , 'r' ) as testfile : #NEWLINE# #INDENT# assert ( str ( num ) == testfile . read ( ) )