Make test for keyFromDirectory more stable.