renaming testdata to sample-documents

This commit is contained in:
Martin A. Brown 2016-02-26 12:26:41 -08:00
parent f40ff2f915
commit a7c5df6253
12 changed files with 15 additions and 19 deletions

View File

@ -13,48 +13,48 @@ import tldp.doctypes
opj = os.path.join
opd = os.path.dirname
opa = os.path.abspath
testdatadir = opa(opj(opd(__file__), 'testdata'))
sampledocs = opa(opj(opd(__file__), 'sample-documents'))
ex_linuxdoc = SimpleNamespace(
ext='.sgml',
type=tldp.doctypes.linuxdoc.Linuxdoc,
filename=opj(testdatadir, 'linuxdoc-simple.sgml'),
filename=opj(sampledocs, 'linuxdoc-simple.sgml'),
)
ex_docbooksgml = SimpleNamespace(
ext='.sgml',
type=tldp.doctypes.docbooksgml.DocbookSGML,
filename=opj(testdatadir, 'docbooksgml-simple.sgml'),
filename=opj(sampledocs, 'docbooksgml-simple.sgml'),
)
ex_docbook4xml = SimpleNamespace(
ext='.xml',
type=tldp.doctypes.docbook4xml.Docbook4XML,
filename=opj(testdatadir, 'docbook4xml-simple.xml'),
filename=opj(sampledocs, 'docbook4xml-simple.xml'),
)
ex_docbook5xml = SimpleNamespace(
ext='.xml',
type=tldp.doctypes.docbook5xml.Docbook5XML,
filename=opj(testdatadir, 'docbook5xml-simple.xml'),
filename=opj(sampledocs, 'docbook5xml-simple.xml'),
)
ex_rst = SimpleNamespace(
ext='.rst',
type=tldp.doctypes.rst.RestructuredText,
filename=opj(testdatadir, 'restructuredtext-simple.rst'),
filename=opj(sampledocs, 'restructuredtext-simple.rst'),
)
ex_text = SimpleNamespace(
ext='.txt',
type=tldp.doctypes.text.Text,
filename=opj(testdatadir, 'text-simple.txt'),
filename=opj(sampledocs, 'text-simple.txt'),
)
ex_markdown = SimpleNamespace(
ext='.md',
type=tldp.doctypes.markdown.Markdown,
filename=opj(testdatadir, 'markdown-simple.md'),
filename=opj(sampledocs, 'markdown-simple.md'),
)

View File

@ -15,8 +15,6 @@ import example
# -- SUT
from tldp.inventory import Inventory
datadir = os.path.join(os.path.dirname(__file__), 'testdata')
class TestOutputDirSkeleton(OutputNamingConvention):

View File

@ -13,8 +13,6 @@ from tldp.outputs import OutputCollection
from tldp.outputs import OutputDirectory
from tldp.outputs import OutputNamingConvention
datadir = os.path.join(os.path.dirname(__file__), 'testdata')
class TestOutputNamingConvention(unittest.TestCase):

View File

@ -19,7 +19,7 @@ import example
# -- SUT
from tldp.sources import SourceCollection, SourceDocument, scansourcedirs
datadir = os.path.join(os.path.dirname(__file__), 'testdata')
datadir = os.path.join(os.path.dirname(__file__), 'sample-documents')
class TestFileSourceCollectionMultiDir(TestToolsFilesystem):

View File

@ -62,24 +62,24 @@ class Test_arg_isloglevel(unittest.TestCase):
class Test_execute(TestToolsFilesystem):
def test_execute_returns_zero(self):
exe = which ('true')
exe = which('true')
result = execute([exe], logdir=self.tempdir)
self.assertEqual(0, result)
def test_execute_returns_nonzero(self):
exe = which ('false')
exe = which('false')
result = execute([exe], logdir=self.tempdir)
self.assertEqual(1, result)
def test_execute_exception_when_logdir_none(self):
exe = which ('true')
exe = which('true')
with self.assertRaises(ValueError) as ecm:
execute([exe], logdir=None)
e = ecm.exception
self.assertTrue('logdir must be a directory' in e.message)
def test_execute_exception_when_logdir_enoent(self):
exe = which ('true')
exe = which('true')
logdir = os.path.join(self.tempdir, 'nonexistent-directory')
with self.assertRaises(IOError) as ecm:
execute([exe], logdir=logdir)
@ -114,11 +114,11 @@ class Test_which(unittest.TestCase):
class Test_statfiles(unittest.TestCase):
def test_statfiles_dir_in_result(self):
'''Assumes that directory ./testdata/ exists here'''
'''Assumes that directory ./sample-documents/ exists here'''
here = os.path.dirname(os.path.abspath(__file__))
statinfo = statfiles(here, relative=here)
self.assertIsInstance(statinfo, dict)
self.assertTrue(os.path.basename('testdata') in statinfo)
self.assertTrue(os.path.basename('sample-documents') in statinfo)
def test_statfiles_dir_rel(self):
here = os.path.dirname(os.path.abspath(__file__))