Exemplo n.º 1
0
    def test_raise_for_missing_documentary(self):
        with directory() as tmp:
            # given
            with self.assertRaises(Exception) as error:
                # when
                resolve_paths(args(root=tmp(), template='src'))

            # then
            self.assertEqual(
                tmp.strip(str(error.exception)),
                'To generate documentation, navigate to a directory with "documentary" folder'
            )
Exemplo n.º 2
0
    def test_raise_for_missing_template(self):
        with directory() as tmp:
            # given
            tmp.dir('documentary')

            # when
            with self.assertRaises(Exception) as error:
                # when
                resolve_paths(args(root=tmp(), template='src'))

            # then
            self.assertEqual(
                r"""Tried to documentation file "src", but it doesn't exist""",
                tmp.strip((str(error.exception))))
Exemplo n.º 3
0
    def test_raise_for_missing_documentation(self):
        with directory() as tmp:
            # given
            tmp.dir('documentary')
            tmp.store(['src'], '')

            # when
            with self.assertRaises(Exception) as error:
                # when
                resolve_paths(args(root=tmp(), template='src'))

            # then
            self.assertEqual(
                'Directory "src" is missing in documentary folder',
                str(error.exception))
Exemplo n.º 4
0
    def test_default(self):
        with directory() as tmp:
            # given
            tmp.dir('documentary')
            tmp.store(['src'], '')
            tmp.store(['documentary', 'src'], '')

            # when
            doc, root, template, output = resolve_paths(
                args(root=tmp(), template='src'))

            # then
            self.assertEqual(
                tmp('documentary'),
                doc,
                msg='Failed to assert that documentary path is returned')
            self.assertEqual(
                tmp(),
                root,
                msg=
                'Failed to assert that root path is current working directory')
            self.assertEqual(
                'src',
                template,
                msg=
                'Failed to assert template is joined with current working directory'
            )
            self.assertEqual(
                root,
                output,
                msg="Failed to assert that output path is root path")
Exemplo n.º 5
0
def main():
    documentary_path, root_path, template, output_path = resolve_paths(parse_args())
    document_many(documentary_path, root_path, template, output_path)