diff --git a/.buckversion b/.buckversion index 3436abae95..4965ceadbe 100644 --- a/.buckversion +++ b/.buckversion @@ -1 +1 @@ -63e0e52ddf3de13ae012ba6d8563bd3f82bcf9de +a0298c530b41eade38c703a3f528e390d619c5b4 diff --git a/tools/BUCK b/tools/BUCK index 08ced89546..ee26062cb1 100644 --- a/tools/BUCK +++ b/tools/BUCK @@ -21,7 +21,7 @@ python_library( visibility = ['PUBLIC'], ) -python_library( +python_test( name = 'util_test', srcs = ['util_test.py'], deps = [':util'], @@ -44,13 +44,3 @@ genrule( visibility = ['PUBLIC'], ) -java_test( - name = 'python_tests', - srcs = glob(['PythonTestCaller.java']), - deps = [ - '//lib:guava', - '//lib:junit', - ':util', - ':util_test', - ], -) diff --git a/tools/PythonTestCaller.java b/tools/PythonTestCaller.java deleted file mode 100644 index deabeb4668..0000000000 --- a/tools/PythonTestCaller.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2013 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -import static org.junit.Assert.assertTrue; - -import com.google.common.io.ByteStreams; -import com.google.common.base.Splitter; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import org.junit.Test; - -public class PythonTestCaller { - - @Test - public void resolveUrl() throws Exception { - PythonTestCaller.pythonUnit("tools", "util_test"); - } - - private static void pythonUnit(String d, String sut) throws Exception { - ProcessBuilder b = - new ProcessBuilder(Splitter.on(' ').splitToList( - "python -m unittest " + sut)) - .directory(new File(d)) - .redirectErrorStream(true); - Process p = null; - InputStream i = null; - byte[] out; - try { - p = b.start(); - i = p.getInputStream(); - out = ByteStreams.toByteArray(i); - } catch (IOException e) { - throw new Exception(e); - } finally { - if (p != null) { - p.getOutputStream().close(); - } - if (i != null) { - i.close(); - } - } - int value; - try { - value = p.waitFor(); - } catch (InterruptedException e) { - throw new Exception("interrupted waiting for process"); - } - String err = new String(out, "UTF-8"); - if (value != 0) { - System.err.print(err); - } - assertTrue(err, value == 0); - } -}