Repository URL to install this package:
|
Version:
1.26.0.dev0+gite506aa5f ▾
|
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from twitter.common.collections import maybe_list
from pants.backend.python.targets.python_target import PythonTarget
class PythonTests(PythonTarget):
"""Python tests.
:API: public
"""
# These are the patterns matched by pytest's test discovery, plus pytest's config hook file.
default_sources_globs = ("test_*.py", "*_test.py", "conftest.py")
@classmethod
def alias(cls):
return "python_tests"
def __init__(self, coverage=None, timeout=None, **kwargs):
"""
:param coverage: the module(s) whose coverage should be generated, e.g.
'twitter.common.log' or ['twitter.common.log', 'twitter.common.http']
:param int timeout: A timeout (in seconds) which covers the total runtime of all tests in this
target. Only applied if `--test-pytest-timeouts` is set to True.
"""
self._coverage = maybe_list(coverage) if coverage is not None else []
self._timeout = timeout
super().__init__(**kwargs)
@property
def coverage(self):
"""
:API: public
"""
return self._coverage
@property
def timeout(self):
"""
:API: public
"""
return self._timeout