#NEWLINE# def test_alwaysPreferPy( self ) : #NEWLINE# #INDENT# '\n        Verify that .py files will always be preferred to .pyc files, regardless of\n        directory listing order.\n        ' #NEWLINE# mypath = FilePath ( self . mktemp ( ) ) #NEWLINE# mypath . createDirectory ( ) #NEWLINE# pp = modules . PythonPath ( sysPath = [ mypath . path ] ) #NEWLINE# originalSmartPath = pp . _smartPath #NEWLINE# def _evilSmartPath( pathName ) : #NEWLINE# #INDENT# o = originalSmartPath ( pathName ) #NEWLINE# originalChildren = o . children #NEWLINE# def evilChildren( ) : #NEWLINE# #INDENT# x = originalChildren ( ) #NEWLINE# x . sort ( ) #NEWLINE# x . reverse ( ) #NEWLINE# return x #NEWLINE# #UNINDENT# o . children = evilChildren #NEWLINE# return o #NEWLINE# #UNINDENT# mypath . child ( 'abcd.py' ) . setContent ( '\n' ) #NEWLINE# compileall . compile_dir ( mypath . path , quiet = True ) #NEWLINE# self . assertEqual ( len ( mypath . children ( ) ) , 2 ) #NEWLINE# pp . _smartPath = mypath #NEWLINE# self . assertEqual ( pp [ 'abcd' ] . filePath , mypath . child ( 'abcd.py' ) )