コード例 #1
0
ファイル: init.py プロジェクト: wjin33/moose
def init_sqa_config(app, category):
    """Creates default file to load from MooseDocs configuration."""
    template = os.path.join(os.path.dirname(__file__), 'sqa_app.yml.template')

    with open(template, 'r') as fid:
        content = fid.read()

    repo = mooseutils.git_repo(MooseDocs.ROOT_DIR)
    content = mooseutils.apply_template_arguments(content,
                                                  repo=repo,
                                                  category=category,
                                                  app=app)

    filename = os.path.join(os.getcwd(), 'sqa_{}.yml'.format(category))
    _write_file(filename, content)
コード例 #2
0
ファイル: test_gitutils.py プロジェクト: jbadger95/moose
    def testGitRepo(self, mock_out):
        mock_out.return_value.stdout = 'origin [email protected]:aeslaughter/moose.git (fetch)\n' \
                                       'origin [email protected]:aeslaughter/moose.git (push)\n' \
                                       'upstream [email protected]:idaholab/moose.git (fetch)' \
                                       'upstream [email protected]:idaholab/moose.git (push)'

        url = mooseutils.git_repo(os.path.dirname(__file__))
        self.assertEqual(url, 'https://github.com/idaholab/moose')

        url = mooseutils.git_repo(os.path.dirname(__file__), remotes=['origin'])
        self.assertEqual(url, 'https://github.com/aeslaughter/moose')

        with self.assertRaises(OSError) as e:
            mooseutils.git_repo('wrong')
        self.assertEqual(str(e.exception), "The supplied location must be a directory: wrong")

        with self.assertRaises(OSError) as e:
            mooseutils.git_repo(os.path.dirname(__file__), remotes=['wrong'])
        self.assertEqual(str(e.exception), "Unable to locate a remote with the name(s): wrong")