Commit b9313b4c authored by dpranke@chromium.org's avatar dpranke@chromium.org

Remove the concept of 'integration tests' from test-webkitpy.

There's not really a useful difference between unittests and integration
tests in webkitpy these days, so this removes the integrationtest concept
and renames the files for consistency w/ everything else.

This is being done in preparation for replacing test-webkitpy with the
generic python test runner (by removing nonstandard things from test-webkitpy).

This also removes the custom TestLoader I wrote since we don't need it any more.

R=eseidel@chromium.org
BUG=402172

Review URL: https://codereview.chromium.org/454223003

git-svn-id: svn://svn.chromium.org/blink/trunk@180235 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5bb473a5
......@@ -70,8 +70,6 @@ class TestPlatformInfo(unittest.TestCase):
def make_info(self, sys_module=None, platform_module=None, executive=None):
return PlatformInfo(sys_module or fake_sys(), platform_module or fake_platform(), executive or fake_executive())
# FIXME: This should be called integration_test_real_code(), but integration tests aren't
# yet run by default and there's no reason not to run this everywhere by default.
def test_real_code(self):
# This test makes sure the real (unmocked) code actually works.
info = PlatformInfo(sys, platform, Executive())
......
......@@ -225,7 +225,6 @@ class RunTest(unittest.TestCase, StreamTestingMixin):
self.assertEqual(host.user.opened_urls, [path.abspath_to_uri(MockHost().platform, '/tmp/layout-test-results/results.html')])
def test_batch_size(self):
batch_tests_run = get_test_batches(['--batch-size', '2'])
for batch in batch_tests_run:
......
......@@ -94,8 +94,6 @@ class Tester(object):
help='run all the tests')
parser.add_option('-c', '--coverage', action='store_true', default=False,
help='generate code coverage info')
parser.add_option('-i', '--integration-tests', action='store_true', default=False,
help='run integration tests as well as unit tests'),
parser.add_option('-j', '--child-processes', action='store', type='int', default=(1 if sys.platform == 'win32' else multiprocessing.cpu_count()),
help='number of tests to run in parallel (default=%default)')
parser.add_option('-p', '--pass-through', action='store_true', default=False,
......@@ -166,14 +164,14 @@ class Tester(object):
return False
self.printer.write_update("Finding the individual test methods ...")
loader = _Loader()
parallel_tests = self._test_names(loader, names)
loader = unittest.TestLoader()
tests = self._test_names(loader, names)
self.printer.write_update("Running the tests ...")
self.printer.num_tests = len(parallel_tests)
self.printer.num_tests = len(tests)
start = time.time()
test_runner = Runner(self.printer, loader, self.webkit_finder)
test_runner.run(parallel_tests, self._options.child_processes)
test_runner.run(tests, self._options.child_processes)
self.printer.print_result(time.time() - start)
......@@ -194,16 +192,10 @@ class Tester(object):
return True
def _test_names(self, loader, names):
parallel_test_method_prefixes = ['test_']
if self._options.integration_tests:
parallel_test_method_prefixes.append('integration_test_')
parallel_tests = []
loader.test_method_prefixes = parallel_test_method_prefixes
tests = []
for name in names:
parallel_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
return parallel_tests
tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
return tests
def _all_test_names(self, suite):
names = []
......@@ -221,18 +213,6 @@ class Tester(object):
_log.error(' ' + l.rstrip())
class _Loader(unittest.TestLoader):
test_method_prefixes = []
def getTestCaseNames(self, testCaseClass):
def isTestMethod(attrname, testCaseClass=testCaseClass):
if not hasattr(getattr(testCaseClass, attrname), '__call__'):
return False
return (any(attrname.startswith(prefix) for prefix in self.test_method_prefixes))
testFnNames = filter(isTestMethod, dir(testCaseClass))
testFnNames.sort()
return testFnNames
if __name__ == '__main__':
sys.exit(main())
......@@ -28,7 +28,7 @@ import StringIO
from webkitpy.common.system.filesystem import FileSystem
from webkitpy.common.system.executive import Executive
from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.test.main import Tester, _Loader
from webkitpy.test.main import Tester
STUBS_CLASS = __name__ + ".TestStubs"
......@@ -38,9 +38,6 @@ class TestStubs(unittest.TestCase):
def test_empty(self):
pass
def integration_test_empty(self):
pass
class TesterTest(unittest.TestCase):
......@@ -73,24 +70,13 @@ class TesterTest(unittest.TestCase):
def _find_test_names(self, args):
tester = Tester()
tester._options, args = tester._parse_args(args)
return tester._test_names(_Loader(), args)
return tester._test_names(unittest.TestLoader(), args)
def test_individual_names_are_not_run_twice(self):
args = [STUBS_CLASS + '.test_empty']
tests = self._find_test_names(args)
self.assertEqual(tests, args)
def test_integration_tests_are_not_found_by_default(self):
tests = self._find_test_names([STUBS_CLASS])
self.assertEqual(tests, [STUBS_CLASS + '.test_empty'])
def test_integration_tests_are_found(self):
tests = self._find_test_names(['--integration-tests', STUBS_CLASS])
self.assertEqual(tests, [
STUBS_CLASS + '.integration_test_empty',
STUBS_CLASS + '.test_empty',
])
def test_coverage_works(self):
# This is awkward; by design, running test-webkitpy -c will
# create a .coverage file in Tools/Scripts, so we need to be
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment