Exemple #1
0
 def setUp(self):
     document = Document(SYS)
     self.tree = Tree(document)
     document.tree = self.tree
     document = Document(FILES)
     self.tree._place(document)  # pylint: disable=W0212
     document.tree = self.tree
Exemple #2
0
 def test_publish_document_template(self, mock_publish):
     """Verify 'doorstop publish' is called with template."""
     path = os.path.join(self.temp, 'req.html')
     self.assertIs(
         None, main(['publish', '--template', 'my_template.html', 'req', path])
     )
     mock_publish.assert_called_once_with(
         Document(os.path.abspath(REQS)), path, '.html', template='my_template.html'
     )
Exemple #3
0
def _document_from_path(path, root, documents):
    """Attempt to create and append a document from the specified path.

    :param path: path to a potential document
    :param root: path to root of working copy
    :param documents: list of :class:`~doorstop.core.document.Document`
        to append results

    """
    try:
        document = Document(path, root, tree=None)  # tree attached later
    except DoorstopError:
        pass  # no document in directory
    else:
        if document.skip:
            log.debug("skipped document: {}".format(document))
        else:
            log.info("found document: {}".format(document))
            documents.append(document)
Exemple #4
0
 def test_publish_document_to_stdout(self, mock_publish_lines):
     """Verify 'doorstop publish_lines' is called when no output path specified"""
     self.assertIs(None, main(['publish', 'req']))
     mock_publish_lines.assert_called_once_with(
         Document(os.path.abspath(REQS)), '.txt')