本文整理汇总了Python中setuptools.command.test.test方法的典型用法代码示例。如果您正苦于以下问题:Python test.test方法的具体用法?Python test.test怎么用?Python test.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.command.test
的用法示例。
在下文中一共展示了test.test方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def main():
setuptools.setup(
name='mobly',
version='1.10',
maintainer='Ang Li',
maintainer_email='mobly-github@googlegroups.com',
description='Automation framework for special end-to-end test cases',
license='Apache2.0',
url='https://github.com/google/mobly',
download_url='https://github.com/google/mobly/tarball/1.10',
packages=setuptools.find_packages(exclude=['tests']),
include_package_data=False,
scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
tests_require=[
'mock',
# Needed for supporting Python 2 because this release stopped supporting Python 2.
'pytest<5.0.0',
'pytz',
],
install_requires=install_requires,
cmdclass={'test': PyTest},
)
示例2: setup_package
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def setup_package():
command_options = {'test': {'test_suite': ('setup.py', 'tests')}}
setup(
name=NAME,
version=VERSION,
url=URL,
description=DESCRIPTION,
author=AUTHOR,
author_email=EMAIL,
license=LICENSE,
keywords=KEYWORDS,
classifiers=CLASSIFIERS,
test_suite='tests',
packages=setuptools.find_packages(exclude=['tests', 'tests.*']),
install_requires=[req for req in read('requirements.txt').split('\\n') if req != ''],
cmdclass={'test': PyTest, 'docker_up': DockerUpCommand, 'docker_down': DockerDownCommand},
tests_require=['pytest-cov', 'pytest'],
command_options=command_options,
entry_points={
'console_scripts': CONSOLE_SCRIPTS,
},
)
示例3: test_warns_deprecation
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def test_warns_deprecation(capfd):
params = dict(
name='foo',
packages=['name', 'name.space', 'name.space.tests'],
namespace_packages=['name'],
test_suite='name.space.tests.test_suite',
use_2to3=True
)
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.ensure_finalized()
cmd.announce = mock.Mock()
cmd.run()
capfd.readouterr()
msg = (
"WARNING: Testing via this command is deprecated and will be "
"removed in a future version. Users looking for a generic test "
"entry point independent of test runner are encouraged to use "
"tox."
)
cmd.announce.assert_any_call(msg, log.WARN)
示例4: test_deprecation_stderr
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def test_deprecation_stderr(capfd):
params = dict(
name='foo',
packages=['name', 'name.space', 'name.space.tests'],
namespace_packages=['name'],
test_suite='name.space.tests.test_suite',
use_2to3=True
)
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.ensure_finalized()
cmd.run()
out, err = capfd.readouterr()
msg = (
"WARNING: Testing via this command is deprecated and will be "
"removed in a future version. Users looking for a generic test "
"entry point independent of test runner are encouraged to use "
"tox.\n"
)
assert msg in err
示例5: test_test
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def test_test(self):
if sys.version < "2.6" or hasattr(sys, 'real_prefix'):
return
dist = Distribution(dict(
name='foo',
packages=['name', 'name.space', 'name.space.tests'],
namespace_packages=['name'],
test_suite='name.space.tests.test_suite',
use_2to3=True,
))
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.user = 1
cmd.ensure_finalized()
cmd.install_dir = site.USER_SITE
cmd.user = 1
old_stdout = sys.stdout
sys.stdout = StringIO()
try:
try: # try/except/finally doesn't work in Python 2.4, so we need nested try-statements.
cmd.run()
except SystemExit: # The test runner calls sys.exit, stop that making an error.
pass
finally:
sys.stdout = old_stdout
示例6: finalize_options
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def finalize_options(self):
test.test.finalize_options(self)
self.test_args = ['-x', "tests/mobly"]
self.test_suite = True
示例7: install_dists
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def install_dists(self, dist):
"""
Extend install_dists to include extras support
"""
return _itertools.chain(
orig.test.install_dists(dist), self.install_extra_dists(dist)
)
示例8: fetch_build_egg
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def fetch_build_egg(self, req):
""" Specialized version of Distribution.fetch_build_egg
that respects respects allow_hosts and index_url. """
from setuptools.command.easy_install import easy_install
dist = Distribution({'script_args': ['easy_install']})
dist.parse_config_files()
opts = dist.get_option_dict('easy_install')
keep = (
'find_links', 'site_dirs', 'index_url', 'optimize',
'site_dirs', 'allow_hosts'
)
for key in list(opts):
if key not in keep:
del opts[key] # don't use any other settings
if self.dependency_links:
links = self.dependency_links[:]
if 'find_links' in opts:
links = opts['find_links'][1].split() + links
opts['find_links'] = ('setup', links)
if self.allow_hosts:
opts['allow_hosts'] = ('test', self.allow_hosts)
if self.index_url:
opts['index_url'] = ('test', self.index_url)
install_dir_func = getattr(self, 'get_egg_cache_dir', _os.getcwd)
install_dir = install_dir_func()
cmd = easy_install(
dist, args=["x"], install_dir=install_dir,
exclude_scripts=True,
always_copy=False, build_directory=None, editable=False,
upgrade=False, multi_version=True, no_report=True, user=False
)
cmd.ensure_finalized()
return cmd.easy_install(req)
示例9: install_dists
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def install_dists(self, dist):
"""
Extend install_dists to include extras support
"""
return _itertools.chain(
orig.test.install_dists(dist),
self.install_extra_dists(dist),
)
示例10: run_tests
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def run_tests(self):
try:
import pytest
except:
raise RuntimeError('py.test is not installed, run: pip install pytest')
params = {'args': self.test_args}
errno = pytest.main(**params)
sys.exit(errno)
示例11: ValidateGoogleTestDir
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def ValidateGoogleTestDir(unused_dist, unused_attr, value):
"""Validate that the test directory is a directory."""
if not os.path.isdir(value):
raise errors.DistutilsSetupError('%s is not a directory' % value)
示例12: finalize_options
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def finalize_options(self):
if self.test_dir is None:
if self.distribution.google_test_dir:
self.test_dir = self.distribution.google_test_dir
else:
raise errors.DistutilsOptionError('No test directory specified')
self.test_module_pattern = re.compile(self.test_module_pattern)
self.test_args = shlex.split(self.test_args)
示例13: run_tests
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def run_tests(self):
self._call('python -m pytest --cov=layered test')
self._call('python -m pylint layered')
self._call('python -m pylint test')
self._call('python -m pylint setup.py')
self._check()
示例14: test_test
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def test_test(capfd):
params = dict(
name='foo',
packages=['name', 'name.space', 'name.space.tests'],
namespace_packages=['name'],
test_suite='name.space.tests.test_suite',
use_2to3=True,
)
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.ensure_finalized()
cmd.run()
out, err = capfd.readouterr()
assert out == 'Foo\n'
示例15: test_tests_are_run_once
# 需要导入模块: from setuptools.command import test [as 别名]
# 或者: from setuptools.command.test import test [as 别名]
def test_tests_are_run_once(capfd):
params = dict(
name='foo',
packages=['dummy'],
)
with open('setup.py', 'wt') as f:
f.write('from setuptools import setup; setup(\n')
for k, v in sorted(params.items()):
f.write(' %s=%r,\n' % (k, v))
f.write(')\n')
os.makedirs('dummy')
with open('dummy/__init__.py', 'wt'):
pass
with open('dummy/test_dummy.py', 'wt') as f:
f.write(DALS(
"""
from __future__ import print_function
import unittest
class TestTest(unittest.TestCase):
def test_test(self):
print('Foo')
"""))
dist = Distribution(params)
dist.script_name = 'setup.py'
cmd = test(dist)
cmd.ensure_finalized()
cmd.run()
out, err = capfd.readouterr()
assert out == 'Foo\n'