本文整理汇总了Python中distutils.command.check.HAS_DOCUTILS属性的典型用法代码示例。如果您正苦于以下问题:Python check.HAS_DOCUTILS属性的具体用法?Python check.HAS_DOCUTILS怎么用?Python check.HAS_DOCUTILS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类distutils.command.check
的用法示例。
在下文中一共展示了check.HAS_DOCUTILS属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_check_restructuredtext
# 需要导入模块: from distutils.command import check [as 别名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 别名]
def test_check_restructuredtext(self):
if not HAS_DOCUTILS: # won't test without docutils
return
# let's see if it detects broken rest in long_description
broken_rest = 'title\n===\n\ntest'
pkg_info, dist = self.create_dist(long_description=broken_rest)
cmd = check(dist)
cmd.check_restructuredtext()
self.assertEqual(cmd._warnings, 1)
# let's see if we have an error with strict=1
metadata = {'url': 'xxx', 'author': 'xxx',
'author_email': 'xxx',
'name': 'xxx', 'version': 'xxx',
'long_description': broken_rest}
self.assertRaises(DistutilsSetupError, self._run, metadata,
**{'strict': 1, 'restructuredtext': 1})
# and non-broken rest
metadata['long_description'] = 'title\n=====\n\ntest'
cmd = self._run(metadata, strict=1, restructuredtext=1)
self.assertEqual(cmd._warnings, 0)
示例2: test_check_restructuredtext
# 需要导入模块: from distutils.command import check [as 别名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 别名]
def test_check_restructuredtext(self):
if not HAS_DOCUTILS: # won't test without docutils
return
# let's see if it detects broken rest in long_description
broken_rest = 'title\n===\n\ntest'
pkg_info, dist = self.create_dist(long_description=broken_rest)
cmd = check(dist)
cmd.check_restructuredtext()
self.assertEqual(cmd._warnings, 1)
# let's see if we have an error with strict=1
metadata = {'url': 'xxx', 'author': 'xxx',
'author_email': 'xxx',
'name': 'xxx', 'version': 'xxx',
'long_description': broken_rest}
self.assertRaises(DistutilsSetupError, self._run, metadata,
**{'strict': 1, 'restructuredtext': 1})
# and non-broken rest, including a non-ASCII character to test #12114
metadata['long_description'] = u'title\n=====\n\ntest \u00df'
cmd = self._run(metadata, strict=1, restructuredtext=1)
self.assertEqual(cmd._warnings, 0)
示例3: test_check_document
# 需要导入模块: from distutils.command import check [as 别名]
# 或者: from distutils.command.check import HAS_DOCUTILS [as 别名]
def test_check_document(self):
if not HAS_DOCUTILS: # won't test without docutils
return
pkg_info, dist = self.create_dist()
cmd = check(dist)
# let's see if it detects broken rest
broken_rest = 'title\n===\n\ntest'
msgs = cmd._check_rst_data(broken_rest)
self.assertEqual(len(msgs), 1)
# and non-broken rest
rest = 'title\n=====\n\ntest'
msgs = cmd._check_rst_data(rest)
self.assertEqual(len(msgs), 0)