'Verify that .py files will always be preferred to .pyc files, regardless of
directory listing order.'

def test_alwaysPreferPy(self):

    mypath = FilePath(self.mktemp())
    mypath.createDirectory()
    pp = modules.PythonPath(sysPath=[mypath.path])
    originalSmartPath = pp._smartPath
    def _evilSmartPath(pathName):
        o = originalSmartPath(pathName)
        originalChildren = o.children
        def evilChildren():
            x = list(originalChildren())
            x.sort()
            x.reverse()
            return x
        o.children = evilChildren
        return o
    mypath.child('abcd.py').setContent('\n')
    compileall.compile_dir(mypath.path, quiet=True)
    self.assertEqual(len(list(mypath.children())), 2)
    pp._smartPath = _evilSmartPath
    self.assertEqual(pp['abcd'].filePath, mypath.child('abcd.py'))
