2011-01-20 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:05:30 +0000 (23:05 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Jan 2011 23:05:30 +0000 (23:05 +0000)
        Reviewed by Eric Seidel.

        nrwt: remove fs refs from printing, test_failures, test_expectations, text_diff

        https://bugs.webkit.org/show_bug.cgi?id=52756

        * Scripts/webkitpy/layout_tests/layout_package/printing.py:
        * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py:
        * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
        * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py:
        * Scripts/webkitpy/layout_tests/layout_package/test_failures.py:
        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76288 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py
Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
Tools/Scripts/webkitpy/layout_tests/layout_package/test_expectations.py
Tools/Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py
Tools/Scripts/webkitpy/layout_tests/test_types/text_diff.py

index bac5054d7c3fadcccea76f2c744eaa5d13e8a68b..c764d225c411530d03e740587ad01523ab9e48d3 100644 (file)
@@ -1,3 +1,18 @@
+2011-01-20  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        nrwt: remove fs refs from printing, test_failures, test_expectations, text_diff
+
+        https://bugs.webkit.org/show_bug.cgi?id=52756
+
+        * Scripts/webkitpy/layout_tests/layout_package/printing.py:
+        * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py:
+        * Scripts/webkitpy/layout_tests/layout_package/test_expectations.py:
+        * Scripts/webkitpy/layout_tests/layout_package/test_expectations_unittest.py:
+        * Scripts/webkitpy/layout_tests/layout_package/test_failures.py:
+        * Scripts/webkitpy/layout_tests/test_types/text_diff.py:
+
 2011-01-20  Mansi Mithal  <mansi.mithal@nokia.com>
 
         Reviewed by Antonio Gomes.
index 7a6aad1a43189aa00d2e2db61a0df049e719f0f8..e10ad9907eb2ac134c519a459a29edc619b03801 100644 (file)
@@ -31,8 +31,6 @@
 
 import logging
 import optparse
-import os
-import pdb
 
 from webkitpy.layout_tests.layout_package import metered_stream
 from webkitpy.layout_tests.layout_package import test_expectations
@@ -411,7 +409,7 @@ class Printer(object):
             return
 
         next_test = test_list[self._current_test_number]
-        next_dir = os.path.dirname(
+        next_dir = self._port._filesystem.dirname(
             self._port.relative_test_filename(next_test))
         if self._current_progress_str == "":
             self._current_progress_str = "%s: " % (next_dir)
@@ -437,7 +435,7 @@ class Printer(object):
                 break
 
             next_test = test_list[self._current_test_number]
-            next_dir = os.path.dirname(
+            next_dir = self._port._filesystem.dirname(
                 self._port.relative_test_filename(next_test))
 
         if result_summary.remaining:
index 9280b0253d7c25e878c730183ef1e9e5a761711d..c3eb04fc17672cb4c53d98959e397e14b307064c 100644 (file)
 
 """Unit tests for printing.py."""
 
-import os
 import optparse
-import pdb
-import sys
 import unittest
 import logging
 
@@ -138,11 +135,11 @@ class  Testprinter(unittest.TestCase):
             failures = [test_failures.FailureTimeout()]
         elif result_type == test_expectations.CRASH:
             failures = [test_failures.FailureCrash()]
-        path = os.path.join(self._port.layout_tests_dir(), test)
+        path = self._port._filesystem.join(self._port.layout_tests_dir(), test)
         return test_results.TestResult(path, failures=failures, test_run_time=run_time)
 
     def get_result_summary(self, tests, expectations_str):
-        test_paths = [os.path.join(self._port.layout_tests_dir(), test) for
+        test_paths = [self._port._filesystem.join(self._port.layout_tests_dir(), test) for
                       test in tests]
         expectations = test_expectations.TestExpectations(
             self._port, test_paths, expectations_str,
index 8645fc1dc187d6dc06cffefc7e4b9866b4e50e7c..806b66347180a8c01c08feedc80b3ff025552468 100644 (file)
@@ -32,9 +32,7 @@ for layout tests.
 """
 
 import logging
-import os
 import re
-import sys
 
 import webkitpy.thirdparty.simplejson as simplejson
 
@@ -322,6 +320,7 @@ class TestExpectationsFile:
         """
 
         self._port = port
+        self._fs = port._filesystem
         self._expectations = expectations
         self._full_test_list = full_test_list
         self._test_platform_name = test_platform_name
@@ -690,9 +689,9 @@ class TestExpectationsFile:
                     'indefinitely, then it should be just timeout.',
                     test_list_path)
 
-            full_path = os.path.join(self._port.layout_tests_dir(),
-                                     test_list_path)
-            full_path = os.path.normpath(full_path)
+            full_path = self._fs.join(self._port.layout_tests_dir(),
+                                      test_list_path)
+            full_path = self._fs.normpath(full_path)
             # WebKit's way of skipping tests is to add a -disabled suffix.
             # So we should consider the path existing if the path or the
             # -disabled version exists.
@@ -736,11 +735,11 @@ class TestExpectationsFile:
         # lists to represent the tree of tests, leaves being test
         # files and nodes being categories.
 
-        path = os.path.join(self._port.layout_tests_dir(), test_list_path)
-        path = os.path.normpath(path)
-        if self._port.path_isdir(path):
+        path = self._fs.join(self._port.layout_tests_dir(), test_list_path)
+        path = self._fs.normpath(path)
+        if self._fs.isdir(path):
             # this is a test category, return all the tests of the category.
-            path = os.path.join(path, '')
+            path = self._fs.join(path, '')
 
             return [test for test in self._full_test_list if test.startswith(path)]
 
@@ -817,7 +816,7 @@ class TestExpectationsFile:
             self._remove_from_sets(test, self._timeline_to_tests)
             self._remove_from_sets(test, self._result_type_to_tests)
 
-        self._test_list_paths[test] = os.path.normpath(test_list_path)
+        self._test_list_paths[test] = self._fs.normpath(test_list_path)
 
     def _remove_from_sets(self, test, dict):
         """Removes the given test from the sets in the dictionary.
@@ -838,7 +837,7 @@ class TestExpectationsFile:
             return False
 
         prev_base_path = self._test_list_paths[test]
-        if (prev_base_path == os.path.normpath(test_list_path)):
+        if (prev_base_path == self._fs.normpath(test_list_path)):
             if (not allow_overrides or test in self._overridding_tests):
                 if allow_overrides:
                     expectation_source = "override"
@@ -854,7 +853,7 @@ class TestExpectationsFile:
                 return False
 
         # Check if we've already seen a more precise path.
-        return prev_base_path.startswith(os.path.normpath(test_list_path))
+        return prev_base_path.startswith(self._fs.normpath(test_list_path))
 
     def _add_error(self, lineno, msg, path):
         """Reports an error that will prevent running the tests. Does not
index 34771f3039aff10a0fd220efa4836755c7728ee3..8f9e5dd0aaa5c638bc43371af5c9059bdae52683 100644 (file)
@@ -29,8 +29,6 @@
 
 """Unit tests for test_expectations.py."""
 
-import os
-import sys
 import unittest
 
 from webkitpy.layout_tests import port
@@ -82,11 +80,12 @@ class FunctionsTest(unittest.TestCase):
 class Base(unittest.TestCase):
     def __init__(self, testFunc, setUp=None, tearDown=None, description=None):
         self._port = port.get('test', None)
+        self._fs = self._port._filesystem
         self._exp = None
         unittest.TestCase.__init__(self, testFunc)
 
     def get_test(self, test_name):
-        return os.path.join(self._port.layout_tests_dir(), test_name)
+        return self._fs.join(self._port.layout_tests_dir(), test_name)
 
     def get_basic_tests(self):
         return [self.get_test('failures/expected/text.html'),
index 2b8190b5fc47a6e5bd59b42e42bf0c55e6264e23..5ad2e04ce1d549caece93eb9fbb2f6751eb288cc 100644 (file)
@@ -29,7 +29,6 @@
 
 """Classes for failures that occur during tests."""
 
-import os
 import test_expectations
 
 import cPickle
@@ -121,7 +120,10 @@ class TestFailure(object):
         Return:
           The relative windows path to the output filename
         """
-        return os.path.splitext(filename)[0] + modifier
+        # FIXME: technically this breaks if files don't use ".ext" to indicate
+        # the extension, but passing in a Filesystem object here is a huge
+        # hassle.
+        return filename[filename.rfind('.')] + modifier
 
 
 class FailureWithType(TestFailure):
index ad252629d3eb7af650d3bb251b7e24c357f86bb9..7b7febe05bb7130c2a17c99bae0ffcd6d8439a96 100644 (file)
@@ -33,12 +33,8 @@ If the output doesn't match, returns FailureTextMismatch and outputs the diff
 files into the layout test results directory.
 """
 
-from __future__ import with_statement
-
-import codecs
 import errno
 import logging
-import os.path
 
 from webkitpy.layout_tests.layout_package import test_failures
 from webkitpy.layout_tests.test_types import test_type_base