Fix resolving modules and directories in tests