diff --git a/contrib/buildgen/src/python/pants/contrib/buildgen/build_file_manipulator.py b/contrib/buildgen/src/python/pants/contrib/buildgen/build_file_manipulator.py index 031cc6658c7..c7bf0b423de 100644 --- a/contrib/buildgen/src/python/pants/contrib/buildgen/build_file_manipulator.py +++ b/contrib/buildgen/src/python/pants/contrib/buildgen/build_file_manipulator.py @@ -204,7 +204,6 @@ def is_ignored_line(line): 'Build file was: {build_file}. Line number was: {lineno}' .format(build_file=build_file, lineno=keyword.value.lineno)) - # Same setup as for getting the target's interval target_call_intervals = [t.value.lineno - target_call.lineno for t in target_call.keywords] target_call_intervals.append(len(target_source_lines)) @@ -239,7 +238,6 @@ def is_ignored_line(line): # print('\n\n') # print(target_call_intervals) - def get_dependencies_node(target_call): for keyword in target_call.keywords: if keyword.arg == 'dependencies': diff --git a/contrib/buildgen/tests/python/pants_test/contrib/buildgen/test_build_file_manipulator.py b/contrib/buildgen/tests/python/pants_test/contrib/buildgen/test_build_file_manipulator.py index dd78634da94..c55e28dd869 100644 --- a/contrib/buildgen/tests/python/pants_test/contrib/buildgen/test_build_file_manipulator.py +++ b/contrib/buildgen/tests/python/pants_test/contrib/buildgen/test_build_file_manipulator.py @@ -15,6 +15,7 @@ class BuildFileManipulatorTest(BaseTest): + def setUp(self): super(BuildFileManipulatorTest, self).setUp() self.complicated_dep_comments = dedent( @@ -64,7 +65,6 @@ def setUp(self): # Also this one though it's weird""" ) - def test_malformed_targets(self): bad_targets = dedent( """ diff --git a/contrib/scrooge/src/python/pants/contrib/scrooge/tasks/scrooge_gen.py b/contrib/scrooge/src/python/pants/contrib/scrooge/tasks/scrooge_gen.py index e5647d3002c..ea1e961ebf4 100644 --- a/contrib/scrooge/src/python/pants/contrib/scrooge/tasks/scrooge_gen.py +++ b/contrib/scrooge/src/python/pants/contrib/scrooge/tasks/scrooge_gen.py @@ -43,6 +43,7 @@ class DepLookupError(AddressLookupError): pass class PartialCmd(namedtuple('PC', ['language', 'rpc_style', 'namespace_map'])): + @property def relative_outdir(self): namespace_sig = None diff --git a/contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter_integration.py b/contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter_integration.py index 6f761a9fd91..549e1acfe29 100644 --- a/contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter_integration.py +++ b/contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_thrift_linter_integration.py @@ -9,6 +9,7 @@ class ThriftLinterTest(PantsRunIntegrationTest): + @staticmethod def thrift_test_target(name): return 'contrib/scrooge/tests/thrift/org/pantsbuild/contrib/scrooge/thrift_linter:' + name diff --git a/examples/src/python/example/pants_publish_plugin/extra_test_jar_example.py b/examples/src/python/example/pants_publish_plugin/extra_test_jar_example.py index 4d8bb266b8f..0c507f35f19 100644 --- a/examples/src/python/example/pants_publish_plugin/extra_test_jar_example.py +++ b/examples/src/python/example/pants_publish_plugin/extra_test_jar_example.py @@ -29,7 +29,6 @@ def __init__(self, context, workdir): # Constructor for custom task. Setup things that you need at pants initialization time. super(ExtraTestJarExample, self).__init__(context, workdir) - # This method is called by pants, when the RoundEngine gets to the phase where your task is # attached. def execute(self): diff --git a/pants-plugins/tests/python/internal_backend_test/sitegen/test_sitegen.py b/pants-plugins/tests/python/internal_backend_test/sitegen/test_sitegen.py index c18241749ec..4eb950c8033 100644 --- a/pants-plugins/tests/python/internal_backend_test/sitegen/test_sitegen.py +++ b/pants-plugins/tests/python/internal_backend_test/sitegen/test_sitegen.py @@ -80,6 +80,7 @@ class AllTheThingsTestCase(unittest.TestCase): + def setUp(self): self.config = json.loads(CONFIG_JSON) self.soups = { @@ -133,7 +134,6 @@ def test_find_title(self): self.assertEqual(p1_html, u'東京 is Tokyo', """Didn't find correct non-ASCII title""") - def test_page_toc(self): # One of our "pages" has a couple of basic headings. # Do we get the correct info from that to generate diff --git a/src/python/pants/backend/android/tasks/dx_compile.py b/src/python/pants/backend/android/tasks/dx_compile.py index 96328caeb53..ca380184f24 100644 --- a/src/python/pants/backend/android/tasks/dx_compile.py +++ b/src/python/pants/backend/android/tasks/dx_compile.py @@ -91,7 +91,6 @@ def _compile_dex(self, args, build_tools_version): return self.runjava(classpath=classpath, jvm_options=jvm_options, main=java_main, args=args, workunit_name='dx') - def _filter_unpacked_dir(self, target, unpacked_dir, class_files): # The Dx tool returns failure if more than one copy of a class is packed into the dex file and # it is easy to fetch duplicate libraries (as well as conflicting versions) from the SDK repos. diff --git a/src/python/pants/backend/android/tasks/unpack_libraries.py b/src/python/pants/backend/android/tasks/unpack_libraries.py index 64ea08b719f..e61b8a0e02f 100644 --- a/src/python/pants/backend/android/tasks/unpack_libraries.py +++ b/src/python/pants/backend/android/tasks/unpack_libraries.py @@ -97,7 +97,6 @@ def create_classes_jar_target(self, target, archive, jar_file): derived_from=target) return new_target - def create_resource_target(self, target, archive, manifest, resource_dir): """Create an AndroidResources target. diff --git a/src/python/pants/backend/codegen/tasks/jaxb_gen.py b/src/python/pants/backend/codegen/tasks/jaxb_gen.py index 96010857790..e38c01fe41c 100644 --- a/src/python/pants/backend/codegen/tasks/jaxb_gen.py +++ b/src/python/pants/backend/codegen/tasks/jaxb_gen.py @@ -141,7 +141,7 @@ def _sources_to_be_generated(self, package, path): outdir = package.replace('.', '/') return [os.path.join(outdir, '{}.java'.format(name)) for name in names] - class JaxbGlobalCodegenStrategy(SimpleCodegenTask.GlobalCodegenStrategy): + def find_sources(self, target): return self._task.sources_generated_by_target(target) diff --git a/src/python/pants/backend/codegen/tasks/protobuf_gen.py b/src/python/pants/backend/codegen/tasks/protobuf_gen.py index 4858e50b93d..9c7a2da0856 100644 --- a/src/python/pants/backend/codegen/tasks/protobuf_gen.py +++ b/src/python/pants/backend/codegen/tasks/protobuf_gen.py @@ -251,8 +251,8 @@ def calculate_java_genfiles(self, protobuf_parse): for classname in classnames: yield os.path.join(basepath, '{0}.java'.format(classname)) - class ProtobufGlobalCodegenStrategy(SimpleCodegenTask.GlobalCodegenStrategy): + def find_sources(self, target): return self._task.sources_generated_by_target(target) diff --git a/src/python/pants/backend/codegen/tasks/simple_codegen_task.py b/src/python/pants/backend/codegen/tasks/simple_codegen_task.py index 7d7594073ad..e342263d2e6 100644 --- a/src/python/pants/backend/codegen/tasks/simple_codegen_task.py +++ b/src/python/pants/backend/codegen/tasks/simple_codegen_task.py @@ -281,7 +281,6 @@ def resolve_deps(self, unresolved_deps): raise self.DepLookupError('{message}\n on dependency {dep}'.format(message=e, dep=dep)) return deps - class CodegenStrategy(AbstractClass): """Abstract strategies for running codegen. @@ -325,7 +324,6 @@ def codegen_workdir_suffix(self, target): def __str__(self): return self.name() - class GlobalCodegenStrategy(CodegenStrategy): """Code generation strategy which generates all code together, in base directory.""" @@ -353,7 +351,6 @@ def find_sources(self, target): def codegen_workdir_suffix(self, target): return self.name() - class IsolatedCodegenStrategy(CodegenStrategy): """Code generate strategy which generates the code for each target separately. @@ -459,13 +456,11 @@ def record_duplicates(dep): self._generated_sources_cache[target.id] = strict return strict - class DuplicateSourceError(TaskError): """A target generated the same code that was generated by one of its dependencies. This is only thrown when --allow-dups=False. """ - class UnsupportedStrategyError(TaskError): """Generated when there is no strategy for a given name.""" diff --git a/src/python/pants/backend/codegen/tasks/wire_gen.py b/src/python/pants/backend/codegen/tasks/wire_gen.py index 63537dbdb97..d9d0ba18f92 100644 --- a/src/python/pants/backend/codegen/tasks/wire_gen.py +++ b/src/python/pants/backend/codegen/tasks/wire_gen.py @@ -29,6 +29,7 @@ class WireGen(JvmToolTaskMixin, SimpleCodegenTask): + @classmethod def register_options(cls, register): super(WireGen, cls).register_options(register) diff --git a/src/python/pants/backend/core/tasks/dependees.py b/src/python/pants/backend/core/tasks/dependees.py index 81fc889d637..698f214ee96 100644 --- a/src/python/pants/backend/core/tasks/dependees.py +++ b/src/python/pants/backend/core/tasks/dependees.py @@ -31,7 +31,6 @@ def register_options(cls, register): "can be specified at once in a comma separated list or else by " "using multiple instances of this flag.") - def __init__(self, *args, **kwargs): super(ReverseDepmap, self).__init__(*args, **kwargs) @@ -40,7 +39,6 @@ def __init__(self, *args, **kwargs): self._dependees_type = self.get_options().type self._spec_excludes = self.get_options().spec_excludes - def console_output(self, _): buildfiles = OrderedSet() address_mapper = self.context.address_mapper diff --git a/src/python/pants/backend/core/tasks/group_task.py b/src/python/pants/backend/core/tasks/group_task.py index dcac83446be..8616fbcbe06 100644 --- a/src/python/pants/backend/core/tasks/group_task.py +++ b/src/python/pants/backend/core/tasks/group_task.py @@ -17,6 +17,7 @@ class GroupMember(TaskBase): + @classmethod def name(cls): """Returns a name for this group for display purposes. diff --git a/src/python/pants/backend/core/tasks/run_prep_command.py b/src/python/pants/backend/core/tasks/run_prep_command.py index 075e9b2b7c7..de17205e5bb 100644 --- a/src/python/pants/backend/core/tasks/run_prep_command.py +++ b/src/python/pants/backend/core/tasks/run_prep_command.py @@ -15,6 +15,7 @@ class RunPrepCommand(Task): + def execute(self): targets = self.context.targets(postorder=True) Cmdline = namedtuple('Cmdline', ['cmdline', 'environ']) diff --git a/src/python/pants/backend/core/tasks/scm_publish.py b/src/python/pants/backend/core/tasks/scm_publish.py index c228ecb1e23..83670960473 100644 --- a/src/python/pants/backend/core/tasks/scm_publish.py +++ b/src/python/pants/backend/core/tasks/scm_publish.py @@ -15,6 +15,7 @@ class Version(object): + @staticmethod def parse(version): """Attempts to parse the given string as Semver, then falls back to Namedver.""" @@ -61,6 +62,7 @@ def __repr__(self): class Semver(Version): + @staticmethod def parse(version): components = version.split('.', 3) diff --git a/src/python/pants/backend/core/wrapped_globs.py b/src/python/pants/backend/core/wrapped_globs.py index 37b056bd09a..8911f52cc61 100644 --- a/src/python/pants/backend/core/wrapped_globs.py +++ b/src/python/pants/backend/core/wrapped_globs.py @@ -31,6 +31,7 @@ def __getitem__(self, index): class FilesetRelPathWrapper(object): + def __init__(self, parse_context): self.rel_path = parse_context.rel_path diff --git a/src/python/pants/backend/jvm/ivy_utils.py b/src/python/pants/backend/jvm/ivy_utils.py index 036e5293d21..8292becb5cd 100644 --- a/src/python/pants/backend/jvm/ivy_utils.py +++ b/src/python/pants/backend/jvm/ivy_utils.py @@ -36,6 +36,7 @@ class IvyModuleRef(object): + def __init__(self, org, name, rev): self.org = org self.name = name @@ -62,6 +63,7 @@ def unversioned(self): class IvyInfo(object): + def __init__(self): self.modules_by_ref = {} # Map from ref to referenced module. # Map from ref of caller to refs of modules required by that caller. diff --git a/src/python/pants/backend/jvm/targets/jar_dependency.py b/src/python/pants/backend/jvm/targets/jar_dependency.py index f6b33cb0292..3f677d91389 100644 --- a/src/python/pants/backend/jvm/targets/jar_dependency.py +++ b/src/python/pants/backend/jvm/targets/jar_dependency.py @@ -57,11 +57,9 @@ def __repr__(self): .format(self.name, self.type_, self.ext, self.conf, self.url, self.classifier)) - class JarDependency(object): """A pre-built Maven repository dependency.""" - _HASH_KEYS = ( 'org', 'name', diff --git a/src/python/pants/backend/jvm/targets/jvm_binary.py b/src/python/pants/backend/jvm/targets/jvm_binary.py index d7ffe92a69b..4a8c5c31c57 100644 --- a/src/python/pants/backend/jvm/targets/jvm_binary.py +++ b/src/python/pants/backend/jvm/targets/jvm_binary.py @@ -21,6 +21,7 @@ class JarRule(FingerprintedMixin, AbstractClass): + def __init__(self, apply_pattern, payload=None): self.payload = payload or Payload() if not isinstance(apply_pattern, string_types): @@ -116,7 +117,6 @@ def __init__(self, apply_pattern, action): }) super(Duplicate, self).__init__(apply_pattern, payload=payload) - @property def action(self): """The action to take for any duplicate entries that match this rule's ``apply_pattern``.""" diff --git a/src/python/pants/backend/jvm/tasks/bundle_create.py b/src/python/pants/backend/jvm/tasks/bundle_create.py index 6e6dd116a8a..c64b6d30de0 100644 --- a/src/python/pants/backend/jvm/tasks/bundle_create.py +++ b/src/python/pants/backend/jvm/tasks/bundle_create.py @@ -19,6 +19,7 @@ class BundleCreate(JvmBinaryTask): + @classmethod def register_options(cls, register): super(BundleCreate, cls).register_options(register) diff --git a/src/python/pants/backend/jvm/tasks/jar_publish.py b/src/python/pants/backend/jvm/tasks/jar_publish.py index 09dec798a99..1a33340cc56 100644 --- a/src/python/pants/backend/jvm/tasks/jar_publish.py +++ b/src/python/pants/backend/jvm/tasks/jar_publish.py @@ -40,6 +40,7 @@ class PushDb(object): + @staticmethod def load(path): """Loads a pushdb maintained in a properties file at the given path.""" @@ -48,6 +49,7 @@ def load(path): return PushDb(properties) class Entry(object): + def __init__(self, sem_ver, named_ver, named_is_latest, sha, fingerprint): """Records the most recent push/release of an artifact. @@ -211,6 +213,7 @@ def jardep(self, jar_dependency, classifier=None): class PomWriter(DependencyWriter): + def __init__(self, get_db, tag): super(PomWriter, self).__init__( get_db, diff --git a/src/python/pants/backend/jvm/tasks/jar_task.py b/src/python/pants/backend/jvm/tasks/jar_task.py index d74fa451639..421bf9f9006 100644 --- a/src/python/pants/backend/jvm/tasks/jar_task.py +++ b/src/python/pants/backend/jvm/tasks/jar_task.py @@ -338,7 +338,6 @@ def __init__(self, context, jar): self._jar = jar self._manifest = Manifest() - def add_target(self, target, recursive=False): """Adds the classes and resources for a target to an open jar. diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/anonymizer.py b/src/python/pants/backend/jvm/tasks/jvm_compile/anonymizer.py index 7dbc5538903..7fe8035c933 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/anonymizer.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/anonymizer.py @@ -58,7 +58,6 @@ def _random_base64_string(): n = random.randint(20, 200) return base64.b64encode(os.urandom(n)) - # Break on delimiters (digits, space, forward slash, dash, underscore, dollar, period) and on # upper-case letters. _DELIMITER = r'\d|\s|/|-|_|\$|\.' diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py b/src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py index 196a64d7068..803566caba9 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py @@ -139,7 +139,6 @@ def compile(self, args, classpath, sources, classes_output_dir, upstream_analysi raise TaskError("Set the target JVM version with the 'target' option or with the jvm " "platform, not in 'args'.") - if self.get_options().source or self.get_options().target: self.context.log.warn('--compile-java-source and --compile-java-target trample and override ' 'target jvm platform settings, and probably should not be used except ' diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile_global_strategy.py b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile_global_strategy.py index d09e0ae1fd9..0642fa57e0e 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile_global_strategy.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_compile_global_strategy.py @@ -197,7 +197,6 @@ def invalidation_hints(self, relevant_targets): return (self._partition_size_hint, locally_changed_targets) - def ordered_compile_settings_and_targets(self, relevant_targets): """Groups the targets into ordered chunks, dependencies before dependees. diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_dependency_analyzer.py b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_dependency_analyzer.py index ed250f989e8..d6608c2a032 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_dependency_analyzer.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/jvm_dependency_analyzer.py @@ -20,6 +20,7 @@ class JvmDependencyAnalyzer(object): + def __init__(self, context, check_missing_deps, @@ -170,7 +171,6 @@ def filter_whitelisted(missing_deps): if self._check_missing_deps == 'fatal': raise TaskError('Missing deps.') - missing_direct_tgt_deps = filter_whitelisted(missing_direct_tgt_deps) if self._check_missing_direct_deps and missing_direct_tgt_deps: diff --git a/src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py b/src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py index a5daff8a52e..bb24e9d4052 100644 --- a/src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py +++ b/src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py @@ -225,7 +225,6 @@ def compile(self, args, classpath, sources, classes_output_dir, upstream_analysi zinc_args.extend(['-analysis-map', ','.join('{}:{}'.format(*kv) for kv in upstream_analysis.items())]) - zinc_args += args zinc_args.extend([ diff --git a/src/python/pants/backend/jvm/tasks/jvmdoc_gen.py b/src/python/pants/backend/jvm/tasks/jvmdoc_gen.py index 3efcad95bc0..86d43d11983 100644 --- a/src/python/pants/backend/jvm/tasks/jvmdoc_gen.py +++ b/src/python/pants/backend/jvm/tasks/jvmdoc_gen.py @@ -21,6 +21,7 @@ class JvmdocGen(JvmTask): + @classmethod def jvmdoc(cls): """Subclasses should return their Jvmdoc configuration.""" diff --git a/src/python/pants/backend/project_info/tasks/ide_gen.py b/src/python/pants/backend/project_info/tasks/ide_gen.py index a96a9b1b697..0da70957c6f 100644 --- a/src/python/pants/backend/project_info/tasks/ide_gen.py +++ b/src/python/pants/backend/project_info/tasks/ide_gen.py @@ -126,6 +126,7 @@ class Error(TaskError): """IdeGen Error.""" class TargetUtil(object): + def __init__(self, context): self.context = context diff --git a/src/python/pants/backend/project_info/tasks/idea_gen.py b/src/python/pants/backend/project_info/tasks/idea_gen.py index 4b765b3502e..78706de7a37 100644 --- a/src/python/pants/backend/project_info/tasks/idea_gen.py +++ b/src/python/pants/backend/project_info/tasks/idea_gen.py @@ -81,7 +81,6 @@ def register_options(cls, register): ], help='Adds folders to be excluded from the project configuration.') - def __init__(self, *args, **kwargs): super(IdeaGen, self).__init__(*args, **kwargs) diff --git a/src/python/pants/backend/python/python_artifact.py b/src/python/pants/backend/python/python_artifact.py index 30ec94761a8..948acef6aa2 100644 --- a/src/python/pants/backend/python/python_artifact.py +++ b/src/python/pants/backend/python/python_artifact.py @@ -15,6 +15,7 @@ class PythonArtifact(PayloadField): """Represents a Python setup.py-based project.""" class MissingArgument(Exception): pass + class UnsupportedArgument(Exception): pass UNSUPPORTED_ARGS = frozenset([ diff --git a/src/python/pants/backend/python/thrift_builder.py b/src/python/pants/backend/python/thrift_builder.py index 5277617e922..c6c1d45d73c 100644 --- a/src/python/pants/backend/python/thrift_builder.py +++ b/src/python/pants/backend/python/thrift_builder.py @@ -20,6 +20,7 @@ class PythonThriftBuilder(CodeGenerator): """Generate Python code from thrift IDL files.""" class UnknownPlatformException(CodeGenerator.Error): + def __init__(self, platform): super(PythonThriftBuilder.UnknownPlatformException, self).__init__( 'Unknown platform: {}!'.format(str(platform))) diff --git a/src/python/pants/base/cache_manager.py b/src/python/pants/base/cache_manager.py index 61ab0c4e6e1..266aa522657 100644 --- a/src/python/pants/base/cache_manager.py +++ b/src/python/pants/base/cache_manager.py @@ -129,6 +129,7 @@ def _partition_versioned_targets(cls, versioned_targets, partition_size_hint, vt # Hack around the python outer scope problem. class VtGroup(object): + def __init__(self): self.vts = [] self.total_chunking_units = 0 diff --git a/src/python/pants/base/target.py b/src/python/pants/base/target.py index 2c85865f297..27e75117180 100644 --- a/src/python/pants/base/target.py +++ b/src/python/pants/base/target.py @@ -148,6 +148,7 @@ def is_other_lang(target): @classmethod def get_addressable_type(target_cls): class ConcreteTargetAddressable(TargetAddressable): + @classmethod def get_target_type(cls): return target_cls diff --git a/src/python/pants/binaries/binary_util.py b/src/python/pants/binaries/binary_util.py index e0463c30eaf..57488806f79 100644 --- a/src/python/pants/binaries/binary_util.py +++ b/src/python/pants/binaries/binary_util.py @@ -71,6 +71,7 @@ class MissingMachineInfo(TaskError): pass class BinaryNotFound(TaskError): + def __init__(self, binary, accumulated_errors): super(BinaryUtil.BinaryNotFound, self).__init__( 'Failed to fetch binary {binary} from any source: ({sources})' diff --git a/src/python/pants/cache/cache_setup.py b/src/python/pants/cache/cache_setup.py index 04c5a7bd90f..979839320b8 100644 --- a/src/python/pants/cache/cache_setup.py +++ b/src/python/pants/cache/cache_setup.py @@ -27,7 +27,6 @@ class InvalidCacheSpecError(ArtifactCacheError): pass class RemoteCacheSpecRequiredError(ArtifactCacheError): pass - class CacheSetup(Subsystem): options_scope = 'cache' @@ -61,6 +60,7 @@ def create_cache_factory_for_task(cls, task): class CacheFactory(object): + def __init__(self, options, log, stable_name, pinger=None): self._options = options self._log = log diff --git a/src/python/pants/cache/local_artifact_cache.py b/src/python/pants/cache/local_artifact_cache.py index 3c4fdde57ca..e81b21e1400 100644 --- a/src/python/pants/cache/local_artifact_cache.py +++ b/src/python/pants/cache/local_artifact_cache.py @@ -18,6 +18,7 @@ logger = logging.getLogger(__name__) class BaseLocalArtifactCache(ArtifactCache): + def __init__(self, artifact_root, compression): """ :param str artifact_root: The path under which cacheable products will be read/written. diff --git a/src/python/pants/engine/round_engine.py b/src/python/pants/engine/round_engine.py index 7715828e838..b75e9eca2d7 100644 --- a/src/python/pants/engine/round_engine.py +++ b/src/python/pants/engine/round_engine.py @@ -17,6 +17,7 @@ class GoalExecutor(object): + def __init__(self, context, goal, tasktypes_by_name): self._context = context self._goal = goal @@ -106,6 +107,7 @@ def add_dependee(goal, dependee=None): in dependees_by_goal.items()))) class TargetRootsReplacement(object): + class ConflictingProposalsError(Exception): """Indicates conflicting proposals for a target root replacement in a single pants run.""" diff --git a/src/python/pants/fs/archive.py b/src/python/pants/fs/archive.py index 98312acce03..8a5ebc8902f 100644 --- a/src/python/pants/fs/archive.py +++ b/src/python/pants/fs/archive.py @@ -20,6 +20,7 @@ class Archiver(AbstractClass): + @classmethod def extract(cls, path, outdir): """Extracts an archive's contents to the specified outdir.""" diff --git a/src/python/pants/goal/run_tracker.py b/src/python/pants/goal/run_tracker.py index 5c847f4ae53..2575fd367fc 100644 --- a/src/python/pants/goal/run_tracker.py +++ b/src/python/pants/goal/run_tracker.py @@ -305,7 +305,6 @@ def get_background_root_workunit(self): self.report.start_workunit(self._background_root_workunit) return self._background_root_workunit - def background_worker_pool(self): if self._background_worker_pool is None: # Initialize lazily. self._background_worker_pool = WorkerPool(parent_workunit=self.get_background_root_workunit(), diff --git a/src/python/pants/java/nailgun_client.py b/src/python/pants/java/nailgun_client.py index f29bd4722e9..6904842159c 100644 --- a/src/python/pants/java/nailgun_client.py +++ b/src/python/pants/java/nailgun_client.py @@ -41,6 +41,7 @@ def __init__(self, sock, ins, out, err): self._err = err class _InputReader(threading.Thread): + def __init__(self, ins, sock, buff_size): threading.Thread.__init__(self) self.daemon = True diff --git a/src/python/pants/option/help_info_extracter.py b/src/python/pants/option/help_info_extracter.py index 0114b764c66..ea877af437b 100644 --- a/src/python/pants/option/help_info_extracter.py +++ b/src/python/pants/option/help_info_extracter.py @@ -43,7 +43,6 @@ class OptionScopeHelpInfo(namedtuple('_OptionScopeHelpInfo', pass - class HelpInfoExtracter(object): """Extracts information useful for displaying help from option registration args.""" diff --git a/src/python/pants/option/parser.py b/src/python/pants/option/parser.py index a1e3fb71ff8..a36b5a9d922 100644 --- a/src/python/pants/option/parser.py +++ b/src/python/pants/option/parser.py @@ -25,6 +25,7 @@ # Standard ArgumentParser prints usage and exits on error. We subclass so we can raise instead. # Note that subclassing ArgumentParser for this purpose is allowed by the argparse API. class CustomArgumentParser(ArgumentParser): + def __init__(self, scope, *args, **kwargs): super(CustomArgumentParser, self).__init__(*args, **kwargs) self._scope = scope @@ -165,7 +166,6 @@ def parse_args(self, args, namespace): stacklevel=9999) # Out of range stacklevel to suppress printing src line. return namespace - def registration_args_iter(self): """Returns an iterator over the registration arguments of each option in this parser. diff --git a/src/python/pants/option/scope.py b/src/python/pants/option/scope.py index 548910895dd..e808bf22c90 100644 --- a/src/python/pants/option/scope.py +++ b/src/python/pants/option/scope.py @@ -18,7 +18,6 @@ class ScopeInfo(namedtuple('_ScopeInfo', ['scope', 'category'])): TASK_SUBSYSTEM = 'TASK_SUBSYSTEM' INTERMEDIATE = 'INTERMEDIATE' # Scoped added automatically to fill out the scope hierarchy. - @classmethod def for_global_scope(cls): return cls('', cls.GLOBAL) diff --git a/src/python/pants/reporting/reporting_server.py b/src/python/pants/reporting/reporting_server.py index fc824f603c9..0c73352f544 100644 --- a/src/python/pants/reporting/reporting_server.py +++ b/src/python/pants/reporting/reporting_server.py @@ -345,6 +345,7 @@ def __init__(self, port, settings): renderer = MustacheRenderer(settings.template_dir, __name__) class MyHandler(PantsHandler): + def __init__(self, request, client_address, server): PantsHandler.__init__(self, settings, renderer, request, client_address, server) @@ -359,6 +360,7 @@ def start(self): class ReportingServerManager(ProcessManager): + def __init__(self, context=None, options=None): ProcessManager.__init__(self, name='reporting_server') self.context = context diff --git a/src/python/pants/scm/git.py b/src/python/pants/scm/git.py index 1e6b9c985b7..fc22e1a5599 100644 --- a/src/python/pants/scm/git.py +++ b/src/python/pants/scm/git.py @@ -296,6 +296,7 @@ def _maybe_start_cat_file_process(self): stdin=subprocess.PIPE, stdout=subprocess.PIPE) class MissingFileException(Exception): + def __init__(self, rev, relpath): self.relpath = relpath self.rev = rev @@ -304,6 +305,7 @@ def __str__(self): return "MissingFileException({}, {})".format(self.relpath, self.rev) class IsDirException(Exception): + def __init__(self, rev, relpath): self.relpath = relpath self.rev = rev @@ -312,6 +314,7 @@ def __str__(self): return "IsDirException({}, {})".format(self.relpath, self.rev) class NotADirException(Exception): + def __init__(self, rev, relpath): self.relpath = relpath self.rev = rev @@ -320,6 +323,7 @@ def __str__(self): return "NotADirException({}, {})".format(self.relpath, self.rev) class SymlinkLoopException(Exception): + def __init__(self, rev, relpath): self.relpath = relpath self.rev = rev @@ -359,16 +363,19 @@ def isdir(self, relpath): return False class Symlink: + def __init__(self, name, sha): self.name = name self.sha = sha class Dir: + def __init__(self, name, sha): self.name = name self.sha = sha class File: + def __init__(self, name, sha): self.name = name self.sha = sha diff --git a/tests/python/pants_test/android/tasks/test_aapt_gen_integration.py b/tests/python/pants_test/android/tasks/test_aapt_gen_integration.py index cdebfece7a7..0f324fb4a73 100644 --- a/tests/python/pants_test/android/tasks/test_aapt_gen_integration.py +++ b/tests/python/pants_test/android/tasks/test_aapt_gen_integration.py @@ -40,7 +40,6 @@ def test_aapt_gen(self): @unittest.skipUnless(tools, reason='Android integration test requires tools {0!r} ' 'and ANDROID_HOME set in path.'.format(TOOLS)) - # TODO(mateor) Write a testproject instead of using hello_with_library which may change. def test_android_library_dep(self): # Doing the work under a tempdir gives us a handle for the workdir and guarantees a clean build. diff --git a/tests/python/pants_test/android/tasks/test_unpack_libraries.py b/tests/python/pants_test/android/tasks/test_unpack_libraries.py index 59be1ad7531..fd02b36a8b0 100644 --- a/tests/python/pants_test/android/tasks/test_unpack_libraries.py +++ b/tests/python/pants_test/android/tasks/test_unpack_libraries.py @@ -215,7 +215,6 @@ def test_unpack_jar_library(self): self.assertIn('Thing.class', files) self.assertEqual(len(test_target.dependencies), 0) - def test_unexpected_archive_type(self): with temporary_dir() as temp: aar = self.create_aarfile(temp, 'org.pantsbuild.android.test') diff --git a/tests/python/pants_test/backend/codegen/tasks/test_protobuf_gen.py b/tests/python/pants_test/backend/codegen/tasks/test_protobuf_gen.py index 926b8639e08..e840716a58e 100644 --- a/tests/python/pants_test/backend/codegen/tasks/test_protobuf_gen.py +++ b/tests/python/pants_test/backend/codegen/tasks/test_protobuf_gen.py @@ -309,6 +309,7 @@ def test_calculate_sources_with_source_root(self): self.assertEquals(OrderedSet(['project/src/main/proto/proto-lib/foo.proto']), result['project/src/main/proto']) class MockLogger: + def __init__(self): self._warn = [] self._error = [] diff --git a/tests/python/pants_test/backend/codegen/tasks/test_simple_codegen_task.py b/tests/python/pants_test/backend/codegen/tasks/test_simple_codegen_task.py index 824858a1c94..df8a4b58bb8 100644 --- a/tests/python/pants_test/backend/codegen/tasks/test_simple_codegen_task.py +++ b/tests/python/pants_test/backend/codegen/tasks/test_simple_codegen_task.py @@ -19,6 +19,7 @@ class SimpleCodegenTaskTest(TaskTestBase): + @classmethod def task_type(cls): return cls.DummyGen @@ -336,5 +337,6 @@ def synthetic_target_type(self): return JavaLibrary class DummyGlobalStrategy(SimpleCodegenTask.GlobalCodegenStrategy): + def find_sources(self, target): return self._task.sources_generated_by_target(target) diff --git a/tests/python/pants_test/backend/codegen/tasks/test_wire_gen.py b/tests/python/pants_test/backend/codegen/tasks/test_wire_gen.py index 20e76e1637f..f5d3589efbc 100644 --- a/tests/python/pants_test/backend/codegen/tasks/test_wire_gen.py +++ b/tests/python/pants_test/backend/codegen/tasks/test_wire_gen.py @@ -20,6 +20,7 @@ class WireGenTest(TaskTestBase): + @classmethod def task_type(cls): return WireGen diff --git a/tests/python/pants_test/backend/core/test_wrapped_globs.py b/tests/python/pants_test/backend/core/test_wrapped_globs.py index 5a4539a952c..ea50d499001 100644 --- a/tests/python/pants_test/backend/core/test_wrapped_globs.py +++ b/tests/python/pants_test/backend/core/test_wrapped_globs.py @@ -15,6 +15,7 @@ class FilesetRelPathWrapperTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/backend/jvm/targets/test_jvm_app.py b/tests/python/pants_test/backend/jvm/targets/test_jvm_app.py index 4baa2ace03e..44182730701 100644 --- a/tests/python/pants_test/backend/jvm/targets/test_jvm_app.py +++ b/tests/python/pants_test/backend/jvm/targets/test_jvm_app.py @@ -19,6 +19,7 @@ class JvmAppTest(BaseTest): + @property def alias_groups(self): return register_jvm() @@ -174,6 +175,7 @@ def test_not_a_binary(self): class BundleTest(BaseTest): + @property def alias_groups(self): return register_core().merge(register_jvm()) diff --git a/tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py b/tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py index 5474a5699cf..a10cf02ebe4 100644 --- a/tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py +++ b/tests/python/pants_test/backend/jvm/targets/test_jvm_binary.py @@ -20,6 +20,7 @@ class JarRulesTest(unittest.TestCase): + def test_jar_rule(self): dup_rule = Duplicate('foo', Duplicate.REPLACE) self.assertEquals('Duplicate(apply_pattern=foo, action=REPLACE)', @@ -57,6 +58,7 @@ def test_set_bad_default(self): class JvmBinaryTest(BaseTest): + @property def alias_groups(self): return register_jvm() diff --git a/tests/python/pants_test/backend/jvm/targets/test_jvm_target.py b/tests/python/pants_test/backend/jvm/targets/test_jvm_target.py index 627681bd796..f1293f4d120 100644 --- a/tests/python/pants_test/backend/jvm/targets/test_jvm_target.py +++ b/tests/python/pants_test/backend/jvm/targets/test_jvm_target.py @@ -25,7 +25,6 @@ def alias_groups(self): 'jvm_target': JvmTarget, })) - def test_traversable_dependency_specs(self): build_file = self.add_to_build_file('BUILD', dedent(''' jvm_target(name='foo', diff --git a/tests/python/pants_test/backend/jvm/targets/test_unpacked_jars.py b/tests/python/pants_test/backend/jvm/targets/test_unpacked_jars.py index 391c2ee27c4..ff550729eac 100644 --- a/tests/python/pants_test/backend/jvm/targets/test_unpacked_jars.py +++ b/tests/python/pants_test/backend/jvm/targets/test_unpacked_jars.py @@ -29,7 +29,6 @@ def test_empty_libraries(self): with self.assertRaises(UnpackedJars.ExpectedLibrariesError): self.build_graph.inject_address_closure(BuildFileAddress(build_file, 'foo')) - def test_simple(self): build_file = self.add_to_build_file('BUILD', dedent(''' unpacked_jars(name='foo', @@ -53,7 +52,6 @@ def test_simple(self): import_jar_dep = target.imported_jars[0] self.assertIsInstance(import_jar_dep, JarDependency) - def test_bad_libraries_ref(self): build_file = self.add_to_build_file('BUILD', dedent(''' unpacked_jars(name='foo', diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/base_compile_integration_test.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/base_compile_integration_test.py index 20dc31e178d..1090697c785 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/base_compile_integration_test.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/base_compile_integration_test.py @@ -14,6 +14,7 @@ class BaseCompileIT(PantsRunIntegrationTest): + @contextmanager def do_test_compile(self, target, strategy, expected_files=None, iterations=2, expect_failure=False, extra_args=None): diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py index b2f2ef057c7..583a1c2f4e7 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py @@ -10,6 +10,7 @@ class AptCompileIntegrationTest(BaseCompileIT): + @provide_compile_strategies def test_apt_compile(self, strategy): with self.do_test_compile('testprojects/src/java/org/pantsbuild/testproject/annotation/processor', diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_java_zinc_compile_integration.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_java_zinc_compile_integration.py index e64657bdf74..512b23af897 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_java_zinc_compile_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_java_zinc_compile_integration.py @@ -13,6 +13,7 @@ class JvmExamplesCompileIntegrationTest(BaseCompileIT): + @provide_compile_strategies def test_java_src_zinc_compile(self, strategy): self.do_test_compile('examples/src/java/::', strategy, extra_args=['--compile-zinc-java-enabled']) diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scala_compile_integration.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scala_compile_integration.py index 745b687bae9..44f7cf5363a 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scala_compile_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scala_compile_integration.py @@ -12,6 +12,7 @@ class ScalaCompileIntegrationTest(BaseCompileIT): + @provide_compile_strategies def test_scala_compile(self, strategy): with self.do_test_compile('testprojects/src/scala/org/pantsbuild/testproject/unicode/shapeless', diff --git a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_resource_mapping.py b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_resource_mapping.py index d1b630ffd27..2e823e4f0c7 100644 --- a/tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_resource_mapping.py +++ b/tests/python/pants_test/backend/jvm/tasks/jvm_compile/test_resource_mapping.py @@ -10,6 +10,7 @@ class ResourceMappingTest(BaseTest): + def test_resource_mapping_ok(self): rel_dir = 'tests/python/pants_test/backend/jvm/tasks/jvm_compile/test-data/resource_mapping' resource_mapping = ResourceMapping(rel_dir) @@ -37,7 +38,6 @@ def test_resource_mapping_mangled(self): with self.assertRaises(ResourceMapping.UnparseableLineException): resource_mapping.mappings - def test_resource_mapping_noitems(self): rel_dir = 'tests/python/pants_test/backend/jvm/tasks/jvm_compile/test-data/resource_mapping-broken-missing-items' resource_mapping = ResourceMapping(rel_dir) diff --git a/tests/python/pants_test/backend/jvm/tasks/test_checkstyle.py b/tests/python/pants_test/backend/jvm/tasks/test_checkstyle.py index 7a6fc7cde58..ab71396fcb7 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_checkstyle.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_checkstyle.py @@ -46,7 +46,6 @@ class CheckstyleTest(NailgunTaskTestBase): } """) - @classmethod def task_type(cls): return Checkstyle diff --git a/tests/python/pants_test/backend/jvm/tasks/test_checkstyle_integration.py b/tests/python/pants_test/backend/jvm/tasks/test_checkstyle_integration.py index 98a104234b7..2d71071841b 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_checkstyle_integration.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_checkstyle_integration.py @@ -13,6 +13,7 @@ class CheckstyleIntegrationTest(PantsRunIntegrationTest): + def test_checkstyle_cached(self): with temporary_dir(root_dir=self.workdir_root()) as cache: with temporary_dir(root_dir=self.workdir_root()) as workdir: diff --git a/tests/python/pants_test/backend/jvm/tasks/test_classpath_util.py b/tests/python/pants_test/backend/jvm/tasks/test_classpath_util.py index 902c35e0785..a10ab000abb 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_classpath_util.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_classpath_util.py @@ -15,6 +15,7 @@ class ClasspathUtilTest(BaseTest): + def test_path_with_differing_conf_ignored(self): a = self.make_target('a', JvmTarget) @@ -40,7 +41,6 @@ def test_path_with_overlapped_conf_added(self): self.assertEqual([path], classpath) - def test_extra_path_added(self): a = self.make_target('a', JvmTarget) diff --git a/tests/python/pants_test/backend/jvm/tasks/test_ivy_imports.py b/tests/python/pants_test/backend/jvm/tasks/test_ivy_imports.py index f6d0213a4a5..327b61b5463 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_ivy_imports.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_ivy_imports.py @@ -21,6 +21,7 @@ class IvyImportsTest(NailgunTaskTestBase): + @classmethod def task_type(cls): return IvyImports @@ -92,7 +93,6 @@ def check_compile(expected_targets): # but should still populate the ivy_imports product by target. check_compile([]) - def verify_product_mapping(self, ivy_imports_product, target=None, org=None, name=None, conf=None, expected_jar_filenames=None): """Verify that the ivy_import_product is formatted correctly. diff --git a/tests/python/pants_test/backend/jvm/tasks/test_ivy_utils.py b/tests/python/pants_test/backend/jvm/tasks/test_ivy_utils.py index 9ce3959a8db..5fd5e0a8376 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_ivy_utils.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_ivy_utils.py @@ -21,6 +21,7 @@ class IvyUtilsTestBase(BaseTest): + @property def alias_groups(self): return register_core().merge(register_jvm()) @@ -117,7 +118,6 @@ def test_exclude_exported_disabled_when_no_excludes_gathered(self): _, excludes = IvyUtils.calculate_classpath([self.b], gather_excludes=False) self.assertSetEqual(excludes, set()) - def test_excludes_generated_when_requested(self): _, excludes = IvyUtils.calculate_classpath([self.e], gather_excludes=True) self.assertSetEqual(excludes, {Exclude(org='commons-lang', name='commons-lang')}) @@ -126,7 +126,6 @@ def test_excludes_empty_when_not_requested(self): _, excludes = IvyUtils.calculate_classpath([self.e], gather_excludes=False) self.assertSetEqual(excludes, set()) - def test_classifiers(self): jars, _ = IvyUtils.calculate_classpath([self.c]) @@ -247,7 +246,6 @@ def collector(r): }, result1) - def find_single(self, elem, xpath): results = list(elem.findall(xpath)) self.assertEqual(1, len(results)) diff --git a/tests/python/pants_test/backend/jvm/tasks/test_jvm_run.py b/tests/python/pants_test/backend/jvm/tasks/test_jvm_run.py index c9e6e6a20ee..760e505dfd8 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_jvm_run.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_jvm_run.py @@ -15,6 +15,7 @@ class JvmRunTest(TaskTestBase): + @classmethod def task_type(cls): return JvmRun diff --git a/tests/python/pants_test/backend/jvm/tasks/test_scalastyle.py b/tests/python/pants_test/backend/jvm/tasks/test_scalastyle.py index 7220a7be6c0..84bdafb4d59 100644 --- a/tests/python/pants_test/backend/jvm/tasks/test_scalastyle.py +++ b/tests/python/pants_test/backend/jvm/tasks/test_scalastyle.py @@ -238,7 +238,6 @@ def main(args: Array[String]) { self.execute(context) - def test_fail(self): # Default scalastyle config (import grouping rule) and no excludes. diff --git a/tests/python/pants_test/backend/project_info/tasks/test_export.py b/tests/python/pants_test/backend/project_info/tasks/test_export.py index e9c6868e067..03d786b8a4b 100644 --- a/tests/python/pants_test/backend/project_info/tasks/test_export.py +++ b/tests/python/pants_test/backend/project_info/tasks/test_export.py @@ -30,6 +30,7 @@ class ProjectInfoTest(ConsoleTaskTestBase): + @classmethod def task_type(cls): return Export diff --git a/tests/python/pants_test/backend/project_info/tasks/test_filedeps.py b/tests/python/pants_test/backend/project_info/tasks/test_filedeps.py index e6488e569c1..4ecdd2243ed 100644 --- a/tests/python/pants_test/backend/project_info/tasks/test_filedeps.py +++ b/tests/python/pants_test/backend/project_info/tasks/test_filedeps.py @@ -17,6 +17,7 @@ class FileDepsTest(ConsoleTaskTestBase): + @property def alias_groups(self): return register_core().merge(register_jvm()).merge(register_codegen()) @@ -154,7 +155,6 @@ def create_target(path, definition, sources=None): """), sources=['config/app.yaml']) - def test_resources(self): self.assert_console_output( 'src/resources/lib/BUILD', diff --git a/tests/python/pants_test/backend/project_info/tasks/test_ide_gen.py b/tests/python/pants_test/backend/project_info/tasks/test_ide_gen.py index e9e1e7239a5..738e53e7a50 100644 --- a/tests/python/pants_test/backend/project_info/tasks/test_ide_gen.py +++ b/tests/python/pants_test/backend/project_info/tasks/test_ide_gen.py @@ -13,6 +13,7 @@ class IdeGenTest(BaseTest): + def test_collapse_source_root(self): source_set_list = [] self.assertEquals([], Project._collapse_by_source_root(source_set_list)) diff --git a/tests/python/pants_test/backend/python/tasks/test_python_eval.py b/tests/python/pants_test/backend/python/tasks/test_python_eval.py index b126a91533d..caa5f89bbcf 100644 --- a/tests/python/pants_test/backend/python/tasks/test_python_eval.py +++ b/tests/python/pants_test/backend/python/tasks/test_python_eval.py @@ -15,6 +15,7 @@ class PythonEvalTest(PythonTaskTest): + @classmethod def task_type(cls): return PythonEval diff --git a/tests/python/pants_test/base/test_build_file_address_mapper.py b/tests/python/pants_test/base/test_build_file_address_mapper.py index fc5796709bb..aaa86dd6458 100644 --- a/tests/python/pants_test/base/test_build_file_address_mapper.py +++ b/tests/python/pants_test/base/test_build_file_address_mapper.py @@ -19,6 +19,7 @@ # explicit unit tests: addresses_in_spec_path, spec_to_address, spec_to_addresses class BuildFileAddressMapperTest(BaseTest): + def setUp(self): super(BuildFileAddressMapperTest, self).setUp() diff --git a/tests/python/pants_test/base/test_build_file_parser.py b/tests/python/pants_test/base/test_build_file_parser.py index acdd245dd7a..22f62b8564c 100644 --- a/tests/python/pants_test/base/test_build_file_parser.py +++ b/tests/python/pants_test/base/test_build_file_parser.py @@ -28,11 +28,13 @@ # parse_build_file_family class ErrorTarget(Target): + def __init__(self, *args, **kwargs): assert False, "This fake target should never be initialized in this test!" class BuildFileParserBasicsTest(BaseTest): + def test_addressable_exceptions(self): self.add_to_build_file('a/BUILD', 'target()') build_file_a = FilesystemBuildFile(self.build_root, 'a/BUILD') @@ -67,6 +69,7 @@ def test_noop_parse(self): class BuildFileParserTargetTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create(targets={'fake': ErrorTarget}) @@ -164,6 +167,7 @@ def test_sibling_build_files_duplicates(self): class BuildFileParserExposedObjectTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create(objects={'fake_object': object()}) @@ -176,6 +180,7 @@ def test_exposed_object(self): class BuildFileParserExposedContextAwareObjectFactoryTest(BaseTest): + @staticmethod def make_lib(parse_context): def real_make_lib(org, name, rev): @@ -337,7 +342,6 @@ def test_raises_execute_error(self): with self.assertRaises(BuildFileParser.ExecuteError): self.build_file_parser.parse_build_file(build_file) - def test_build_file_parser_error_hierarcy(self): """Exception handling code depends on the fact that all explicit exceptions from BuildFileParser are subclassed from the BuildFileParserError base class. diff --git a/tests/python/pants_test/base/test_build_graph.py b/tests/python/pants_test/base/test_build_graph.py index d0318be9883..63afac7ce99 100644 --- a/tests/python/pants_test/base/test_build_graph.py +++ b/tests/python/pants_test/base/test_build_graph.py @@ -15,6 +15,7 @@ # TODO(Eric Ayers) There are many untested methods in BuildGraph left to be tested. class BuildGraphTest(BaseTest): + def inject_graph(self, root_spec, graph_dict): """Given a root spec, injects relevant targets from the graph represented by graph_dict. diff --git a/tests/python/pants_test/base/test_cmd_line_spec_parser.py b/tests/python/pants_test/base/test_cmd_line_spec_parser.py index 5715067dd84..52abf302750 100644 --- a/tests/python/pants_test/base/test_cmd_line_spec_parser.py +++ b/tests/python/pants_test/base/test_cmd_line_spec_parser.py @@ -16,6 +16,7 @@ class CmdLineSpecParserTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create( @@ -153,6 +154,7 @@ def test_exclude_malformed_build_file(self): self.assert_parsed_list(cmdline_spec_list=['::'], expected=expected_specs) class CmdLineSpecParserBadBuildTest(BaseTest): + def setUp(self): super(CmdLineSpecParserBadBuildTest, self).setUp() diff --git a/tests/python/pants_test/base/test_extension_loader.py b/tests/python/pants_test/base/test_extension_loader.py index 1777c6c2e59..f153e1ec4b6 100644 --- a/tests/python/pants_test/base/test_extension_loader.py +++ b/tests/python/pants_test/base/test_extension_loader.py @@ -27,6 +27,7 @@ class MockMetadata(EmptyProvider): + def __init__(self, metadata): self.metadata = metadata @@ -49,6 +50,7 @@ class DummySubsystem2(Subsystem): class DummyTarget(Target): + @classmethod def subsystems(cls): return super(DummyTarget, cls).subsystems() + (DummySubsystem1, ) @@ -60,16 +62,19 @@ class DummyObject1(object): class DummyObject2(object): + @classmethod def subsystems(cls): return (DummySubsystem2, ) class DummyTask(Task): + def execute(self): return 42 class LoaderTest(unittest.TestCase): + def setUp(self): self.build_configuration = BuildConfiguration() self.working_set = WorkingSet() @@ -165,7 +170,6 @@ def test_load_missing_plugin(self): with self.assertRaises(PluginNotFound): self.load_plugins(['Foobar']) - def get_mock_plugin(self, name, version, reg=None, alias=None, after=None): """Make a fake Distribution (optionally with entry points) diff --git a/tests/python/pants_test/base/test_filesystem_build_file.py b/tests/python/pants_test/base/test_filesystem_build_file.py index d7e65c567cf..35eef46e4a8 100644 --- a/tests/python/pants_test/base/test_filesystem_build_file.py +++ b/tests/python/pants_test/base/test_filesystem_build_file.py @@ -16,6 +16,7 @@ class FilesystemBuildFileTest(BuildFileTestBase): + def setUp(self): super(FilesystemBuildFileTest, self).setUp() self.buildfile = self.create_buildfile('grandparent/parent/BUILD') diff --git a/tests/python/pants_test/base/test_generator.py b/tests/python/pants_test/base/test_generator.py index 7001795f44a..989c3aa3b60 100644 --- a/tests/python/pants_test/base/test_generator.py +++ b/tests/python/pants_test/base/test_generator.py @@ -11,6 +11,7 @@ class TemplateDataTest(unittest.TestCase): + def setUp(self): self.data = TemplateData(foo = 'bar', baz = 42) diff --git a/tests/python/pants_test/base/test_lazy_source_mapper.py b/tests/python/pants_test/base/test_lazy_source_mapper.py index 0f0f042f7b6..efc8a9c0478 100644 --- a/tests/python/pants_test/base/test_lazy_source_mapper.py +++ b/tests/python/pants_test/base/test_lazy_source_mapper.py @@ -12,6 +12,7 @@ class LazySourceMapperTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/base/test_payload.py b/tests/python/pants_test/base/test_payload.py index 46a9151bcbd..0bae1af73db 100644 --- a/tests/python/pants_test/base/test_payload.py +++ b/tests/python/pants_test/base/test_payload.py @@ -14,6 +14,7 @@ class PayloadTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/base/test_payload_field.py b/tests/python/pants_test/base/test_payload_field.py index 777d9bb5cc7..4428bbb0f9b 100644 --- a/tests/python/pants_test/base/test_payload_field.py +++ b/tests/python/pants_test/base/test_payload_field.py @@ -18,6 +18,7 @@ class PayloadTest(BaseTest): + def test_excludes_field(self): empty = ExcludesField() empty_fp = empty.fingerprint() @@ -264,6 +265,7 @@ def test_sources_field(self): def test_fingerprinted_field(self): class TestValue(FingerprintedMixin): + def __init__(self, test_value): self.test_value = test_value diff --git a/tests/python/pants_test/base/test_source_root.py b/tests/python/pants_test/base/test_source_root.py index 47384d784a7..6eed890cd60 100644 --- a/tests/python/pants_test/base/test_source_root.py +++ b/tests/python/pants_test/base/test_source_root.py @@ -18,18 +18,21 @@ class TestTarget(Target): + def __init__(self, spec): spec_path, target_name = parse_spec(spec) super(TestTarget, self).__init__(target_name, SyntheticAddress.parse(spec), None) class NotTestTarget(Target): + def __init__(self, spec): spec_path, target_name = parse_spec(spec) super(NotTestTarget, self).__init__(target_name, SyntheticAddress.parse(spec), None) class AnotherTarget(Target): + def __init__(self, spec): spec_path, target_name = parse_spec(spec) super(AnotherTarget, self).__init__(target_name, SyntheticAddress.parse(spec), None) diff --git a/tests/python/pants_test/base/test_spec_exclude_integration.py b/tests/python/pants_test/base/test_spec_exclude_integration.py index f9c55492ff7..a1b9aa92123 100644 --- a/tests/python/pants_test/base/test_spec_exclude_integration.py +++ b/tests/python/pants_test/base/test_spec_exclude_integration.py @@ -21,6 +21,7 @@ class Bundles(object): phrase_path = 'testprojects/src/java/org/pantsbuild/testproject/phrases' class Bundle(object): + def __init__(self, spec, text): self.spec = spec self.text = text diff --git a/tests/python/pants_test/base/test_validation.py b/tests/python/pants_test/base/test_validation.py index eec1c029df4..766f3754b5f 100644 --- a/tests/python/pants_test/base/test_validation.py +++ b/tests/python/pants_test/base/test_validation.py @@ -11,6 +11,7 @@ class ParseValidation(unittest.TestCase): + def test_valid_inputs(self): list_result0 = assert_list(["file1.txt"]) list_result1 = assert_list(["file1.txt", "file2.txt"]) diff --git a/tests/python/pants_test/cache/test_cache_setup.py b/tests/python/pants_test/cache/test_cache_setup.py index f793f933c08..606ed43d874 100644 --- a/tests/python/pants_test/cache/test_cache_setup.py +++ b/tests/python/pants_test/cache/test_cache_setup.py @@ -33,6 +33,7 @@ def global_subsystems(cls): class MockPinger(object): + def __init__(self, hosts_to_times): self._hosts_to_times = hosts_to_times diff --git a/tests/python/pants_test/ivy/test_bootstrapper.py b/tests/python/pants_test/ivy/test_bootstrapper.py index f208dc384a1..ddc71a58541 100644 --- a/tests/python/pants_test/ivy/test_bootstrapper.py +++ b/tests/python/pants_test/ivy/test_bootstrapper.py @@ -26,6 +26,7 @@ def global_subsystems(cls): class BootstrapperTest(JvmToolTaskTestBase): + @classmethod def task_type(cls): return DummyBootstrapperTask diff --git a/tests/python/pants_test/ivy/test_ivy_subsystem.py b/tests/python/pants_test/ivy/test_ivy_subsystem.py index 6cd8ac1a032..014d06a64be 100644 --- a/tests/python/pants_test/ivy/test_ivy_subsystem.py +++ b/tests/python/pants_test/ivy/test_ivy_subsystem.py @@ -23,6 +23,7 @@ def global_subsystems(cls): class IvySubsystemTest(JvmToolTaskTestBase): + @classmethod def task_type(cls): return DummyIvyTask diff --git a/tests/python/pants_test/option/test_custom_types.py b/tests/python/pants_test/option/test_custom_types.py index 31113262ce0..eda587b3364 100644 --- a/tests/python/pants_test/option/test_custom_types.py +++ b/tests/python/pants_test/option/test_custom_types.py @@ -12,6 +12,7 @@ class CustomTypesTest(unittest.TestCase): + def _do_test(self, expected_val, s): if isinstance(expected_val, dict): val = dict_type(s) diff --git a/tests/python/pants_test/option/test_option_value_container.py b/tests/python/pants_test/option/test_option_value_container.py index a6c6196cec0..62e9626bc1a 100644 --- a/tests/python/pants_test/option/test_option_value_container.py +++ b/tests/python/pants_test/option/test_option_value_container.py @@ -13,6 +13,7 @@ class OptionValueContainerTest(unittest.TestCase): + def test_standard_values(self): o = OptionValueContainer() o.foo = 1 diff --git a/tests/python/pants_test/projects/test_testprojects_integration.py b/tests/python/pants_test/projects/test_testprojects_integration.py index bed5f90ade5..8feed951938 100644 --- a/tests/python/pants_test/projects/test_testprojects_integration.py +++ b/tests/python/pants_test/projects/test_testprojects_integration.py @@ -10,6 +10,7 @@ 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. diff --git a/tests/python/pants_test/scm/test_git.py b/tests/python/pants_test/scm/test_git.py index 62e565f5d8e..bb4619347a4 100644 --- a/tests/python/pants_test/scm/test_git.py +++ b/tests/python/pants_test/scm/test_git.py @@ -22,6 +22,7 @@ class Version(object): + def __init__(self, text): self._components = map(int, text.split('.')) @@ -34,6 +35,7 @@ def __cmp__(self, other): class VersionTest(unittest.TestCase): + def test_equal(self): self.assertEqual(Version('1'), Version('1.0.0.0')) self.assertEqual(Version('1.0'), Version('1.0.0.0')) @@ -65,6 +67,7 @@ def git_version(): @pytest.mark.skipif("git_version() < Version('1.7.10')") class GitTest(unittest.TestCase): + @staticmethod def init_repo(remote_name, remote): subprocess.check_call(['git', 'init']) @@ -513,6 +516,7 @@ def test_commit_with_new_untracked_file_adds_file(self): class DetectWorktreeFakeGitTest(unittest.TestCase): + @contextmanager def empty_path(self): with temporary_dir() as path: diff --git a/tests/python/pants_test/targets/test_jvm_app_integration.py b/tests/python/pants_test/targets/test_jvm_app_integration.py index eb07c7ff239..23122b35f51 100644 --- a/tests/python/pants_test/targets/test_jvm_app_integration.py +++ b/tests/python/pants_test/targets/test_jvm_app_integration.py @@ -9,6 +9,7 @@ class TestJvmAppIntegrationTest(PantsRunIntegrationTest): + def test_smoke(self): pants_run = self.run_pants(['bundle', 'testprojects/src/java/org/pantsbuild/testproject/bundle']) diff --git a/tests/python/pants_test/targets/test_python_binary.py b/tests/python/pants_test/targets/test_python_binary.py index 6d4a9347183..1a6a1e9d002 100644 --- a/tests/python/pants_test/targets/test_python_binary.py +++ b/tests/python/pants_test/targets/test_python_binary.py @@ -13,6 +13,7 @@ class TestPythonBinary(BaseTest): + def test_python_binary_must_have_some_entry_point(self): with pytest.raises(TargetDefinitionException): self.make_target(spec=':binary', target_type=PythonBinary) diff --git a/tests/python/pants_test/targets/test_sort_targets.py b/tests/python/pants_test/targets/test_sort_targets.py index b12ef95e011..f616436f8d9 100644 --- a/tests/python/pants_test/targets/test_sort_targets.py +++ b/tests/python/pants_test/targets/test_sort_targets.py @@ -12,6 +12,7 @@ class SortTargetsTest(BaseTest): + def test_validation(self): valid = self.make_target(':valid') diff --git a/tests/python/pants_test/targets/test_wiki_page.py b/tests/python/pants_test/targets/test_wiki_page.py index 5bd03a85fb4..c647f447391 100644 --- a/tests/python/pants_test/targets/test_wiki_page.py +++ b/tests/python/pants_test/targets/test_wiki_page.py @@ -15,6 +15,7 @@ class WikiPageTest(BaseTest): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/tasks/test_antlr_integration.py b/tests/python/pants_test/tasks/test_antlr_integration.py index b801c3acd9f..f35888f3ad7 100644 --- a/tests/python/pants_test/tasks/test_antlr_integration.py +++ b/tests/python/pants_test/tasks/test_antlr_integration.py @@ -12,6 +12,7 @@ class AntlrIntegrationTest(PantsRunIntegrationTest): + def test_run_antlr3(self): stdout_data = self.bundle_and_run('examples/src/java/org/pantsbuild/example/antlr3', 'antlr3', args=['7*8']) @@ -22,7 +23,6 @@ def test_run_antlr4(self): args=['7*6']) self.assertEquals('42.0', stdout_data.rstrip(), msg="got output:{0}".format(stdout_data)) - # Test that antlr3 and antlr4 generated java targets are cache-able. def test_compile_antlr_cached(self): for enable_zinc_java in ['--compile-zinc-java-enabled', '--no-compile-zinc-java-enabled']: diff --git a/tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py b/tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py index 0b4899f230c..8ccd7ceddbe 100644 --- a/tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py +++ b/tests/python/pants_test/tasks/test_bootstrap_jvm_tools_integration.py @@ -10,6 +10,7 @@ class BootstrapJvmToolsIntegrationTest(PantsRunIntegrationTest): + def test_scala_java_reuse(self): with temporary_dir(root_dir=self.workdir_root()) as artifact_cache: bootstrap_args = [ diff --git a/tests/python/pants_test/tasks/test_cache_manager.py b/tests/python/pants_test/tasks/test_cache_manager.py index 3f5aeb636ed..acf6b9a625d 100644 --- a/tests/python/pants_test/tasks/test_cache_manager.py +++ b/tests/python/pants_test/tasks/test_cache_manager.py @@ -40,7 +40,9 @@ def print_vt(vt): class InvalidationCacheManagerTest(BaseTest): + class TestInvalidationCacheManager(InvalidationCacheManager): + def __init__(self, tmpdir): InvalidationCacheManager.__init__(self, AppendingCacheKeyGenerator(), tmpdir, True) diff --git a/tests/python/pants_test/tasks/test_check_published_deps.py b/tests/python/pants_test/tasks/test_check_published_deps.py index bf1fe786836..6983edda1aa 100644 --- a/tests/python/pants_test/tasks/test_check_published_deps.py +++ b/tests/python/pants_test/tasks/test_check_published_deps.py @@ -20,6 +20,7 @@ class CheckPublishedDepsTest(ConsoleTaskTestBase): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/tasks/test_dependees.py b/tests/python/pants_test/tasks/test_dependees.py index 9e73b5dc1da..7b0a9da00bf 100644 --- a/tests/python/pants_test/tasks/test_dependees.py +++ b/tests/python/pants_test/tasks/test_dependees.py @@ -23,6 +23,7 @@ class BaseReverseDepmapTest(ConsoleTaskTestBase): + @classmethod def task_type(cls): return ReverseDepmap @@ -37,11 +38,13 @@ def assert_console_output(self, *args, **kwargs): class ReverseDepmapEmptyTest(BaseReverseDepmapTest): + def test(self): self.assert_console_output(targets=[]) class ReverseDepmapTest(BaseReverseDepmapTest): + @property def alias_groups(self): return BuildFileAliases.create( diff --git a/tests/python/pants_test/tasks/test_eclipse_integration.py b/tests/python/pants_test/tasks/test_eclipse_integration.py index 7971ff72721..665a7033a89 100644 --- a/tests/python/pants_test/tasks/test_eclipse_integration.py +++ b/tests/python/pants_test/tasks/test_eclipse_integration.py @@ -12,6 +12,7 @@ class EclipseIntegrationTest(PantsRunIntegrationTest): + def _eclipse_test(self, specs, project_dir=os.path.join('.pants.d', 'tmp', 'test-eclipse'), project_name='project'): """Helper method that tests eclipse generation on the input spec list.""" diff --git a/tests/python/pants_test/tasks/test_execution_graph.py b/tests/python/pants_test/tasks/test_execution_graph.py index 96375b1be13..64466dbfc51 100644 --- a/tests/python/pants_test/tasks/test_execution_graph.py +++ b/tests/python/pants_test/tasks/test_execution_graph.py @@ -13,11 +13,13 @@ class ImmediatelyExecutingPool(object): + def submit_async_work(self, work): work.func(*work.args_tuples[0]) class PrintLogger(object): + def error(self, msg): print(msg) @@ -34,6 +36,7 @@ def raising_fn(): class ExecutionGraphTest(unittest.TestCase): + def setUp(self): self.jobs_run = [] @@ -61,7 +64,6 @@ def test_single_dependency(self): self.assertEqual(self.jobs_run, ["B", "A"]) - def test_simple_binary_tree(self): exec_graph = ExecutionGraph([self.job("A", passing_fn, ["B", "C"]), self.job("B", passing_fn, []), @@ -98,7 +100,6 @@ def test_simple_unconnected_tree(self): self.assertEqual(self.jobs_run, ["B", "C", "A"]) - def test_dependee_depends_on_dependency_of_its_dependency(self): exec_graph = ExecutionGraph([self.job("A", passing_fn, ["B", "C"]), self.job("B", passing_fn, ["C"]), @@ -187,7 +188,6 @@ def test_on_failure_callback_raises_error(self): self.assertEqual("Error in on_failure for A: I'm an error", str(cm.exception)) - def test_same_key_scheduled_twice_is_error(self): with self.assertRaises(JobExistsError) as cm: ExecutionGraph([self.job("Same", passing_fn, []), diff --git a/tests/python/pants_test/tasks/test_filter.py b/tests/python/pants_test/tasks/test_filter.py index b05821f2161..70002b14068 100644 --- a/tests/python/pants_test/tasks/test_filter.py +++ b/tests/python/pants_test/tasks/test_filter.py @@ -21,6 +21,7 @@ class BaseFilterTest(ConsoleTaskTestBase): + @property def alias_groups(self): return BuildFileAliases.create( @@ -39,6 +40,7 @@ def task_type(cls): class FilterEmptyTargetsTest(BaseFilterTest): + def test_no_filters(self): self.assert_console_output() @@ -52,6 +54,7 @@ def test_regex(self): class FilterTest(BaseFilterTest): + def setUp(self): super(FilterTest, self).setUp() diff --git a/tests/python/pants_test/tasks/test_jar_create.py b/tests/python/pants_test/tasks/test_jar_create.py index 71d5f4c74b7..569bc9c4e19 100644 --- a/tests/python/pants_test/tasks/test_jar_create.py +++ b/tests/python/pants_test/tasks/test_jar_create.py @@ -23,6 +23,7 @@ class JarCreateTestBase(JarTaskTestBase): + @classmethod def task_type(cls): return JarCreate @@ -44,6 +45,7 @@ def setUp(self): self.set_options(compressed=False, pants_bootstrapdir='~/.cache/pants', max_subprocess_args=100) class JarCreateMiscTest(JarCreateTestBase): + def test_jar_create_init(self): self.create_task(self.context(), '/tmp/workdir') @@ -56,6 +58,7 @@ def test_resources_with_scala_java_files(self): class JarCreateExecuteTest(JarCreateTestBase): + def java_library(self, path, name, sources, **kwargs): return self.create_library(path, 'java_library', name, sources, **kwargs) @@ -119,7 +122,6 @@ def context(self, **kwargs): target_roots=[self.jl, self.sl, self.binary, self.jtl, self.scala_lib, self.empty_sl], **kwargs) - def assert_jar_contents(self, context, product_type, target, *contents): jar_mapping = context.products.get(product_type).get(target) self.assertEqual(1, len(jar_mapping)) diff --git a/tests/python/pants_test/tasks/test_jar_publish.py b/tests/python/pants_test/tasks/test_jar_publish.py index fbf9853268c..f22531cdbf0 100644 --- a/tests/python/pants_test/tasks/test_jar_publish.py +++ b/tests/python/pants_test/tasks/test_jar_publish.py @@ -29,6 +29,7 @@ class JarPublishTest(TaskTestBase): + @classmethod def task_type(cls): return JarPublish @@ -258,6 +259,7 @@ def test_publish_classifiers(self): self.assertEquals(r, c) class FailNTimes: + def __init__(self, tries, exc_type, success=None): self.tries = tries self.exc_type = exc_type @@ -270,6 +272,7 @@ def __call__(self, *args, **kwargs): return self.success class FailNTimesTest(unittest.TestCase): + def test_fail_n_times(self): with self.assertRaises(ValueError): foo = Mock() diff --git a/tests/python/pants_test/tasks/test_jar_task.py b/tests/python/pants_test/tasks/test_jar_task.py index 7725f6b6c5a..f60e0bbe2b9 100644 --- a/tests/python/pants_test/tasks/test_jar_task.py +++ b/tests/python/pants_test/tasks/test_jar_task.py @@ -25,7 +25,9 @@ class BaseJarTaskTest(JarTaskTestBase): + class TestJarTask(JarTask): + def execute(self): pass @@ -42,7 +44,6 @@ def alias_groups(self): }, )) - def setUp(self): super(BaseJarTaskTest, self).setUp() @@ -216,7 +217,6 @@ def setUp(self): super(JarBuilderTest, self).setUp() self.set_options(max_subprocess_args=100) - def _add_to_classes_by_target(self, context, tgt, filename): class_products = context.products.get_data('classes_by_target', lambda: defaultdict(MultipleRootedProducts)) @@ -226,7 +226,6 @@ def _add_to_classes_by_target(self, context, tgt, filename): [os.path.basename(filename)]) class_products[tgt] = java_agent_products - def test_agent_manifest(self): self.add_to_build_file('src/java/pants/agents', dedent(""" java_agent( diff --git a/tests/python/pants_test/tasks/test_listtargets.py b/tests/python/pants_test/tasks/test_listtargets.py index 7d887e300ee..ddeff70075d 100644 --- a/tests/python/pants_test/tasks/test_listtargets.py +++ b/tests/python/pants_test/tasks/test_listtargets.py @@ -18,12 +18,14 @@ class BaseListTargetsTest(ConsoleTaskTestBase): + @classmethod def task_type(cls): return ListTargets class ListTargetsTestEmpty(BaseListTargetsTest): + def test_list_all_empty(self): self.assertEqual('', self.execute_task()) self.assertEqual('', self.execute_task(options={ 'sep': '###' })) @@ -31,6 +33,7 @@ def test_list_all_empty(self): class ListTargetsTest(BaseListTargetsTest): + @property def alias_groups(self): return BuildFileAliases.create( @@ -52,6 +55,7 @@ def setUp(self): # Setup a BUILD tree for various list tests class Lib(object): + def __init__(self, name, provides=False): self.name = name self.provides = dedent(""" @@ -88,7 +92,6 @@ def create_library(path, *libs): ) ''')) - def test_list_path(self): self.assert_console_output('a/b:b', targets=[self.target('a/b')]) diff --git a/tests/python/pants_test/tasks/test_protobuf_integration.py b/tests/python/pants_test/tasks/test_protobuf_integration.py index 4d981609f8b..dab68ae9558 100644 --- a/tests/python/pants_test/tasks/test_protobuf_integration.py +++ b/tests/python/pants_test/tasks/test_protobuf_integration.py @@ -14,6 +14,7 @@ class ProtobufIntegrationTest(PantsRunIntegrationTest): + def test_bundle_protobuf_normal(self): pants_run = self.run_pants(['bundle', '--deployjar', diff --git a/tests/python/pants_test/tasks/test_sorttargets.py b/tests/python/pants_test/tasks/test_sorttargets.py index e71a0f84940..563efd540d5 100644 --- a/tests/python/pants_test/tasks/test_sorttargets.py +++ b/tests/python/pants_test/tasks/test_sorttargets.py @@ -14,17 +14,20 @@ class BaseSortTargetsTest(ConsoleTaskTestBase): + @classmethod def task_type(cls): return SortTargets class SortTargetsEmptyTest(BaseSortTargetsTest): + def test(self): self.assert_console_output(targets=[]) class SortTargetsTest(BaseSortTargetsTest): + @property def alias_groups(self): return BuildFileAliases.create(targets={'python_library': PythonLibrary}) diff --git a/tests/python/pants_test/tasks/test_targets_help.py b/tests/python/pants_test/tasks/test_targets_help.py index 0834a80b0ca..0730a31fee0 100644 --- a/tests/python/pants_test/tasks/test_targets_help.py +++ b/tests/python/pants_test/tasks/test_targets_help.py @@ -13,6 +13,7 @@ # are the PREDEFS, things like "dependencies: Old name for 'target'". # But we can make sure they don't blow up. class TargetsHelpTest(ConsoleTaskTestBase): + @classmethod def task_type(cls): return TargetsHelp diff --git a/tests/python/pants_test/tasks/test_what_changed.py b/tests/python/pants_test/tasks/test_what_changed.py index c7fdf0f965c..5681b368c55 100644 --- a/tests/python/pants_test/tasks/test_what_changed.py +++ b/tests/python/pants_test/tasks/test_what_changed.py @@ -22,6 +22,7 @@ class BaseWhatChangedTest(ConsoleTaskTestBase): + @property def alias_groups(self): return BuildFileAliases.create( @@ -54,6 +55,7 @@ def assert_console_output(self, *output, **kwargs): def workspace(self, files=None, parent=None, diffspec=None, diff_files=None): class MockWorkspace(Workspace): + def touched_files(_, p): self.assertEqual(parent or 'HEAD', p) return files or [] @@ -64,6 +66,7 @@ def changes_in(_, ds): class WhatChangedTestBasic(BaseWhatChangedTest): + def test_nochanges(self): self.assert_console_output(workspace=self.workspace()) @@ -82,6 +85,7 @@ def test_files(self): class WhatChangedTest(BaseWhatChangedTest): + def setUp(self): super(WhatChangedTest, self).setUp() diff --git a/tests/python/pants_test/util/test_contextutil.py b/tests/python/pants_test/util/test_contextutil.py index 14360340f9f..9725d199b78 100644 --- a/tests/python/pants_test/util/test_contextutil.py +++ b/tests/python/pants_test/util/test_contextutil.py @@ -110,6 +110,7 @@ def test_temporary_dir_with_root_dir(self): def test_timer(self): class FakeClock(object): + def __init__(self): self._time = 0.0