forked from twitter/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved testing of examples and testprojects to tests
Instead of invoking 'test examples/::' and 'test testprojects/::' in ci.sh created Python integration tests for them. Moved compile_strategy_utils.py to testutils. Moved test_binary_util, test_maven_layout and test_thrift_util to util folder. Testing Done: CI passes: https://travis-ci.org/fkorotkov/pants/builds/61192561 Reviewed at https://rbcommons.com/s/twitter/r/2158/
- Loading branch information
Showing
17 changed files
with
150 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
target( | ||
name='projects', | ||
dependencies=[ | ||
':examples_integration', | ||
':testprojects_integration', | ||
] | ||
) | ||
|
||
python_tests( | ||
name='examples_integration', | ||
sources=['test_examples_integration.py'], | ||
dependencies=[ | ||
':base', | ||
'tests/python/pants_test/testutils', | ||
] | ||
) | ||
|
||
python_tests( | ||
name='testprojects_integration', | ||
sources=['test_testprojects_integration.py'], | ||
dependencies=[ | ||
':base', | ||
'tests/python/pants_test/testutils', | ||
] | ||
) | ||
|
||
python_tests( | ||
name='base', | ||
sources=['base_project_integration_test.py'], | ||
dependencies=[ | ||
'tests/python/pants_test:int-test', | ||
] | ||
) |
Empty file.
25 changes: 25 additions & 0 deletions
25
tests/python/pants_test/projects/base_project_integration_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding=utf-8 | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
import os | ||
|
||
from pants_test.pants_run_integration_test import PantsRunIntegrationTest | ||
|
||
|
||
class ProjectIntegrationTest(PantsRunIntegrationTest): | ||
@staticmethod | ||
def _android_flags(): | ||
exclude_android = os.environ.get('SKIP_ANDROID') == "true" or not os.environ.get('ANDROID_HOME') | ||
return ['--exclude-target-regexp=.*android.*'] if exclude_android else [] | ||
|
||
def pants_test(self, strategy, command): | ||
return self.run_pants([ | ||
'test' | ||
'--compile-apt-strategy={}'.format(strategy), | ||
'--compile-java-strategy={}'.format(strategy), | ||
'--compile-scala-strategy={}'.format(strategy), | ||
] + command + self._android_flags()) |
16 changes: 16 additions & 0 deletions
16
tests/python/pants_test/projects/test_examples_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# coding=utf-8 | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants_test.projects.base_project_integration_test import ProjectIntegrationTest | ||
from pants_test.testutils.compile_strategy_utils import provide_compile_strategies | ||
|
||
|
||
class ExamplesIntegrationTest(ProjectIntegrationTest): | ||
@provide_compile_strategies | ||
def tests_examples(self, strategy): | ||
pants_run = self.pants_test(strategy, ['examples::']) | ||
self.assert_success(pants_run) |
44 changes: 44 additions & 0 deletions
44
tests/python/pants_test/projects/test_testprojects_integration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# coding=utf-8 | ||
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pants_test.projects.base_project_integration_test import ProjectIntegrationTest | ||
from pants_test.testutils.compile_strategy_utils import provide_compile_strategies | ||
|
||
|
||
class TestProjectsIntegrationTest(ProjectIntegrationTest): | ||
@provide_compile_strategies | ||
def tests_testprojects(self, strategy): | ||
# TODO(Eric Ayers) find a better way to deal with tests that are known to fail. | ||
# right now, just split them into two categories and ignore them. | ||
|
||
# Targets that fail but shouldn't | ||
known_failing_targets = [ | ||
# The following two targets lose out due to a resource collision, because `example_b` happens | ||
# to be first in the context, and test.junit mixes all classpaths. | ||
'testprojects/maven_layout/resource_collision/example_b/src/test/java/org/pantsbuild/duplicateres/exampleb:exampleb', | ||
'testprojects/maven_layout/resource_collision/example_c/src/test/java/org/pantsbuild/duplicateres/examplec:examplec', | ||
] | ||
|
||
# Targets that are intended to fail | ||
negative_test_targets = [ | ||
'testprojects/src/antlr/pants/backend/python/test:antlr_failure', | ||
'testprojects/src/java/org/pantsbuild/testproject/bundle:missing-files', | ||
'testprojects/src/java/org/pantsbuild/testproject/cycle1', | ||
'testprojects/src/java/org/pantsbuild/testproject/cycle2', | ||
'testprojects/src/java/org/pantsbuild/testproject/missingdepswhitelist.*', | ||
'testprojects/src/python/antlr:test_antlr_failure', | ||
'testprojects/src/scala/org/pantsbuild/testproject/compilation_failure', | ||
'testprojects/src/thrift/org/pantsbuild/thrift_linter:', | ||
'testprojects/tests/java/org/pantsbuild/testproject/empty:', | ||
'testprojects/tests/java/org/pantsbuild/testproject/dummies:failing_target', | ||
'testprojects/tests/python/pants/dummies:failing_target', | ||
] | ||
|
||
targets_to_exclude = known_failing_targets + negative_test_targets | ||
exclude_opts = map(lambda target: '--exclude-target-regexp={}'.format(target), targets_to_exclude) | ||
pants_run = self.pants_test(strategy, ['testprojects::'] + exclude_opts) | ||
self.assert_success(pants_run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters