use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonBuckConfigTest method whenPythonOnPathNotFoundThenThrow.
@Test(expected = HumanReadableException.class)
public void whenPythonOnPathNotFoundThenThrow() throws IOException {
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("interpreter", "does-not-exist"))).setEnvironment(ImmutableMap.<String, String>builder().put("PATH", temporaryFolder.getRoot().toAbsolutePath().toString()).put("PATHEXT", "").build()).build(), new ExecutableFinder());
config.getPythonInterpreter();
fail("Should throw an exception when Python isn't found.");
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonBuckConfigTest method whenToolsPythonIsExecutableFileThenItIsUsed.
@Test
public void whenToolsPythonIsExecutableFileThenItIsUsed() throws IOException {
Path configPythonFile = temporaryFolder.newExecutableFile("python");
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("interpreter", configPythonFile.toAbsolutePath().toString()))).build(), new ExecutableFinder());
assertEquals("Should return path to temp file.", configPythonFile.toAbsolutePath().toString(), config.getPythonInterpreter());
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonTestIntegrationTest method getPythonBuckConfig.
private PythonBuckConfig getPythonBuckConfig() throws IOException {
Config rawConfig = Configs.createDefaultConfig(tmp.getRoot());
BuckConfig buckConfig = new BuckConfig(rawConfig, new ProjectFilesystem(tmp.getRoot()), Architecture.detect(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new DefaultCellPathResolver(tmp.getRoot(), rawConfig));
return new PythonBuckConfig(buckConfig, new ExecutableFinder());
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonBinaryIntegrationTest method getPythonBuckConfig.
private PythonBuckConfig getPythonBuckConfig() throws IOException {
Config rawConfig = Configs.createDefaultConfig(tmp.getRoot());
BuckConfig buckConfig = new BuckConfig(rawConfig, new ProjectFilesystem(tmp.getRoot()), Architecture.detect(), Platform.detect(), ImmutableMap.copyOf(System.getenv()), new DefaultCellPathResolver(tmp.getRoot(), rawConfig));
return new PythonBuckConfig(buckConfig, new ExecutableFinder());
}
use of com.facebook.buck.io.ExecutableFinder in project buck by facebook.
the class PythonBuckConfigTest method whenPythonPlusExtensionOnPathIsExecutableFileThenItIsUsed.
@Test
public void whenPythonPlusExtensionOnPathIsExecutableFileThenItIsUsed() throws IOException {
temporaryFolder.newExecutableFile("my-py.exe");
PythonBuckConfig config = new PythonBuckConfig(FakeBuckConfig.builder().setSections(ImmutableMap.of("python", ImmutableMap.of("interpreter", "my-py"))).setEnvironment(ImmutableMap.<String, String>builder().put("PATH", temporaryFolder.getRoot().toAbsolutePath().toString()).put("PATHEXT", ".exe").build()).build(), new ExecutableFinder(Platform.WINDOWS));
config.getPythonInterpreter();
}
Aggregations