Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For in-memory tests, use the local root
Summary: Because ModulePath directly accesses the filesystem to follow symlinks (this is tech debt which could be eliminated by a proposed ModuleTracker refactor to use abstract filesystems, but is necessary today), we have to bypass `ModulePath.create` when using in-memory source code for unit tests. This is unfortunate but okay. But because we have to bypass `ModulePath.create`, we used `ModulePath.create_for_testing` which requires hardcoding the priority of a search root. This is a problem if we want to change the order of the search roots, as Kyle is experimenting with doing in order to support a source-code fallback for Buck projects while Buck is still running. The fix is to avoid hardcoding a priority by using `Raw.create` to determine the priority from the configuration. Because some other unit tests (unrelated to ScratchProject and in-memory source code) do still require directly creating a ModulePath we make a new function `create_for_in_memory_scratch_project` to use specifically for this case. Reviewed By: kinto0 Differential Revision: D50584161 fbshipit-source-id: 548dd602bcf7875aeaea9b17e5eee5b6b481cd6e
- Loading branch information