mirror of https://github.com/tLDP/python-tldp
pyflakes/pep8 adjustments
This commit is contained in:
parent
174e759d14
commit
dec201f50c
|
@ -23,29 +23,24 @@ def load_content(ex):
|
||||||
|
|
||||||
|
|
||||||
ex_linuxdoc = Namespace(
|
ex_linuxdoc = Namespace(
|
||||||
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
|
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
|
||||||
filename=opj(sampledocs, 'linuxdoc-simple.sgml'),
|
filename=opj(sampledocs, 'linuxdoc-simple.sgml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_docbooksgml = Namespace(
|
ex_docbooksgml = Namespace(
|
||||||
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
|
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
|
||||||
filename=opj(sampledocs, 'docbooksgml-simple.sgml'),
|
filename=opj(sampledocs, 'docbooksgml-simple.sgml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_docbook4xml = Namespace(
|
ex_docbook4xml = Namespace(
|
||||||
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
||||||
filename=opj(sampledocs, 'docbook4xml-simple.xml'),
|
filename=opj(sampledocs, 'docbook4xml-simple.xml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_docbook5xml = Namespace(
|
ex_docbook5xml = Namespace(
|
||||||
doctype=tldp.doctypes.docbook5xml.Docbook5XML,
|
doctype=tldp.doctypes.docbook5xml.Docbook5XML,
|
||||||
filename=opj(sampledocs, 'docbook5xml-simple.xml'),
|
filename=opj(sampledocs, 'docbook5xml-simple.xml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_asciidoc = Namespace(
|
ex_asciidoc = Namespace(
|
||||||
doctype=tldp.doctypes.asciidoc.Asciidoc,
|
doctype=tldp.doctypes.asciidoc.Asciidoc,
|
||||||
filename=opj(sampledocs, 'asciidoc-complete.txt'),
|
filename=opj(sampledocs, 'asciidoc-complete.txt'),)
|
||||||
)
|
|
||||||
#
|
#
|
||||||
# ex_rst = Namespace(
|
# ex_rst = Namespace(
|
||||||
# doctype=tldp.doctypes.rst.RestructuredText,
|
# doctype=tldp.doctypes.rst.RestructuredText,
|
||||||
|
@ -58,22 +53,19 @@ ex_asciidoc = Namespace(
|
||||||
# )
|
# )
|
||||||
|
|
||||||
ex_linuxdoc_dir = Namespace(
|
ex_linuxdoc_dir = Namespace(
|
||||||
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
|
doctype=tldp.doctypes.linuxdoc.Linuxdoc,
|
||||||
filename=opj(sampledocs, 'Linuxdoc-Larger',
|
filename=opj(sampledocs, 'Linuxdoc-Larger',
|
||||||
'Linuxdoc-Larger.sgml'),
|
'Linuxdoc-Larger.sgml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_docbook4xml_dir = Namespace(
|
ex_docbook4xml_dir = Namespace(
|
||||||
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
||||||
filename=opj(sampledocs, 'DocBook-4.2-WHYNOT',
|
filename=opj(sampledocs, 'DocBook-4.2-WHYNOT',
|
||||||
'DocBook-4.2-WHYNOT.xml'),
|
'DocBook-4.2-WHYNOT.xml'),)
|
||||||
)
|
|
||||||
|
|
||||||
ex_docbooksgml_dir = Namespace(
|
ex_docbooksgml_dir = Namespace(
|
||||||
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
|
doctype=tldp.doctypes.docbooksgml.DocbookSGML,
|
||||||
filename=opj(sampledocs, 'DocBookSGML-Larger',
|
filename=opj(sampledocs, 'DocBookSGML-Larger',
|
||||||
'DocBookSGML-Larger.sgml'),
|
'DocBookSGML-Larger.sgml'),)
|
||||||
)
|
|
||||||
|
|
||||||
# -- a bit ugly, but grab each dict
|
# -- a bit ugly, but grab each dict
|
||||||
sources = [y for x, y in locals().items() if x.startswith('ex_')]
|
sources = [y for x, y in locals().items() if x.startswith('ex_')]
|
||||||
|
@ -81,18 +73,14 @@ sources = [y for x, y in locals().items() if x.startswith('ex_')]
|
||||||
for ex in sources:
|
for ex in sources:
|
||||||
load_content(ex)
|
load_content(ex)
|
||||||
|
|
||||||
|
|
||||||
unknown_doctype = Namespace(
|
unknown_doctype = Namespace(
|
||||||
doctype=None,
|
doctype=None,
|
||||||
filename=opj(sampledocs, 'Unknown-Doctype.xqf'),
|
filename=opj(sampledocs, 'Unknown-Doctype.xqf'),)
|
||||||
)
|
|
||||||
|
|
||||||
broken_docbook4xml = Namespace(
|
broken_docbook4xml = Namespace(
|
||||||
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
doctype=tldp.doctypes.docbook4xml.Docbook4XML,
|
||||||
filename=opj(sampledocs, 'docbook4xml-broken.xml'),
|
filename=opj(sampledocs, 'docbook4xml-broken.xml'),)
|
||||||
)
|
|
||||||
load_content(broken_docbook4xml)
|
load_content(broken_docbook4xml)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -- end of file
|
# -- end of file
|
||||||
|
|
|
@ -80,14 +80,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
ap.add_argument('--size', default=9, type=int)
|
ap.add_argument('--size', default=9, type=int)
|
||||||
|
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv=''.split(),
|
argv=''.split(),
|
||||||
env=dict(),
|
env=dict(),
|
||||||
cfg='',
|
cfg='',
|
||||||
exp_config=Namespace(size=9),
|
exp_config=Namespace(size=9),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
|
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
config, args = cc.parse()
|
config, args = cc.parse()
|
||||||
|
@ -99,14 +98,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
ap.add_argument('--size', default=9, type=int)
|
ap.add_argument('--size', default=9, type=int)
|
||||||
|
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv=''.split(),
|
argv=''.split(),
|
||||||
env=dict(),
|
env=dict(),
|
||||||
cfg='[tag]\nsize = 8',
|
cfg='[tag]\nsize = 8',
|
||||||
exp_config=Namespace(size=8),
|
exp_config=Namespace(size=8),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
|
|
||||||
self.writeconfig(c)
|
self.writeconfig(c)
|
||||||
c.env.setdefault('TAG_CONFIGFILE', c.configfile)
|
c.env.setdefault('TAG_CONFIGFILE', c.configfile)
|
||||||
|
@ -122,14 +120,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
import logging
|
import logging
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv=''.split(),
|
argv=''.split(),
|
||||||
env=dict(),
|
env=dict(),
|
||||||
cfg='[tag]\nsize = 8',
|
cfg='[tag]\nsize = 8',
|
||||||
exp_config=Namespace(size=8),
|
exp_config=Namespace(size=8),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
self.writeconfig(c)
|
self.writeconfig(c)
|
||||||
c.argv.extend(['--configfile', c.configfile])
|
c.argv.extend(['--configfile', c.configfile])
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
|
@ -144,14 +141,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
import logging
|
import logging
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv=''.split(),
|
argv=''.split(),
|
||||||
env=dict(TAG_SIZE=7, ),
|
env=dict(TAG_SIZE=7, ),
|
||||||
cfg='[tag]\nsize = 8',
|
cfg='[tag]\nsize = 8',
|
||||||
exp_config=Namespace(size=7),
|
exp_config=Namespace(size=7),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
self.writeconfig(c)
|
self.writeconfig(c)
|
||||||
c.argv.extend(['--configfile', c.configfile])
|
c.argv.extend(['--configfile', c.configfile])
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
|
@ -166,14 +162,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
import logging
|
import logging
|
||||||
logging.getLogger().setLevel(logging.DEBUG)
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv='--size 6'.split(),
|
argv='--size 6'.split(),
|
||||||
env=dict(TAG_SIZE=7, ),
|
env=dict(TAG_SIZE=7, ),
|
||||||
cfg='[tag]\nsize = 8',
|
cfg='[tag]\nsize = 8',
|
||||||
exp_config=Namespace(size=6),
|
exp_config=Namespace(size=6),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
self.writeconfig(c)
|
self.writeconfig(c)
|
||||||
c.argv.extend(['--configfile', c.configfile])
|
c.argv.extend(['--configfile', c.configfile])
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
|
@ -185,14 +180,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
ap.add_argument('--source', default='', action='append', type=str)
|
ap.add_argument('--source', default='', action='append', type=str)
|
||||||
|
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv=''.split(),
|
argv=''.split(),
|
||||||
env=dict(),
|
env=dict(),
|
||||||
cfg='',
|
cfg='',
|
||||||
exp_config=Namespace(source=''),
|
exp_config=Namespace(source=''),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
config, args = cc.parse()
|
config, args = cc.parse()
|
||||||
self.assertEqual(c.exp_config, config)
|
self.assertEqual(c.exp_config, config)
|
||||||
|
@ -203,14 +197,13 @@ class CascadingConfigBasicTest(CCTestTools):
|
||||||
ap.add_argument('--source', default='', action='append', type=str)
|
ap.add_argument('--source', default='', action='append', type=str)
|
||||||
|
|
||||||
c = Namespace(
|
c = Namespace(
|
||||||
tag='tag',
|
tag='tag',
|
||||||
argparser=ap,
|
argparser=ap,
|
||||||
argv='--source /some/path'.split(),
|
argv='--source /some/path'.split(),
|
||||||
env=dict(),
|
env=dict(),
|
||||||
cfg='',
|
cfg='',
|
||||||
exp_config=Namespace(source=['/some/path']),
|
exp_config=Namespace(source=['/some/path']),
|
||||||
exp_args=[],
|
exp_args=[],)
|
||||||
)
|
|
||||||
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
cc = CascadingConfig(c.tag, c.argparser, argv=c.argv, env=c.env)
|
||||||
config, args = cc.parse()
|
config, args = cc.parse()
|
||||||
self.assertEqual(c.exp_config, config)
|
self.assertEqual(c.exp_config, config)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class TestOutputCollection(TestToolsFilesystem):
|
||||||
|
|
||||||
def test_file_in_output_collection(self):
|
def test_file_in_output_collection(self):
|
||||||
reldir, absdir = self.adddir('collection')
|
reldir, absdir = self.adddir('collection')
|
||||||
self.addfile('collection', __file__, stem='non-directory')
|
self.addfile('collection', __file__, stem='non-directory')
|
||||||
oc = OutputCollection(absdir)
|
oc = OutputCollection(absdir)
|
||||||
self.assertEqual(0, len(oc))
|
self.assertEqual(0, len(oc))
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ class Test_arg_isstr(unittest.TestCase):
|
||||||
self.assertEqual('s', arg_isstr('s'))
|
self.assertEqual('s', arg_isstr('s'))
|
||||||
self.assertEqual(None, arg_isstr(7))
|
self.assertEqual(None, arg_isstr(7))
|
||||||
|
|
||||||
|
|
||||||
class Test_arg_isloglevel(unittest.TestCase):
|
class Test_arg_isloglevel(unittest.TestCase):
|
||||||
|
|
||||||
def test_arg_isloglevel_integer(self):
|
def test_arg_isloglevel_integer(self):
|
||||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import absolute_import, division, print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
|
||||||
import codecs
|
import codecs
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -102,7 +101,7 @@ class CCTestTools(unittest.TestCase):
|
||||||
tf = ntf(prefix=case.tag, suffix='.cfg', dir=self.tempdir, delete=False)
|
tf = ntf(prefix=case.tag, suffix='.cfg', dir=self.tempdir, delete=False)
|
||||||
tf.close()
|
tf.close()
|
||||||
with codecs.open(tf.name, 'w', encoding='utf-8') as f:
|
with codecs.open(tf.name, 'w', encoding='utf-8') as f:
|
||||||
f.write(case.cfg)
|
f.write(case.cfg)
|
||||||
case.configfile = tf.name
|
case.configfile = tf.name
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue