Ejemplo n.º 1
0
    def test_get_sphinx_apidoc_command_enabled_with_pep420(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock

        try:
            sphinx_mock.version_info = (1, 5, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(
                get_sphinx_apidoc_command(self.project, self.reactor), [
                    ANY, "-H", "project_name", "-o",
                    np(jp(self.project.basedir,
                          "dir_target/sphinx_pyb/apidoc")),
                    np(jp(self.project.basedir, "dir_source"))
                ])
            self.reactor.pybuilder_venv.version = (3, 5, 6, 'final', 0)
            self.assertEqual(
                get_sphinx_apidoc_command(self.project, self.reactor), [
                    ANY, "-H", "project_name", "--implicit-namespaces", "-o",
                    np(jp(self.project.basedir,
                          "dir_target/sphinx_pyb/apidoc")),
                    np(jp(self.project.basedir, "dir_source"))
                ])
        finally:
            del sys.modules["sphinx"]
Ejemplo n.º 2
0
    def test_get_sphinx_apidoc_command_enabled_with_pep420(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock

        try:
            sphinx_mock.version_info = (1, 5, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(get_sphinx_apidoc_command(self.project),
                             ['sphinx.apidoc',
                              '-H',
                              'project_name',
                              '--implicit-namespaces',
                              '-o',
                              'basedir/dir_target/sphinx_pyb/apidoc',
                              'basedir/dir_source'
                              ] if sys.version_info[:3] >= (3, 3) else
                             ['sphinx.apidoc',
                              '-H',
                              'project_name',
                              '-o',
                              'basedir/dir_target/sphinx_pyb/apidoc',
                              'basedir/dir_source'
                              ]
                             )
        finally:
            del sys.modules["sphinx"]
Ejemplo n.º 3
0
    def test_get_sphinx_apidoc_command_enabled(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock
        try:
            sphinx_mock.version_info = (1, 2, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(get_sphinx_apidoc_command(self.project), [
                'sphinx.apidoc', '-H', 'project_name', '-o',
                'basedir/dir_target/sphinx_pyb/apidoc', 'basedir/dir_source'
            ])
        finally:
            del sys.modules["sphinx"]
Ejemplo n.º 4
0
    def test_get_sphinx_apidoc_command_enabled(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock

        try:
            sphinx_mock.version_info = (1, 2, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(
                get_sphinx_apidoc_command(self.project, self.reactor), [
                    ANY, "-H", "project_name", "-o",
                    np(jp(self.project.basedir,
                          "dir_target/sphinx_pyb/apidoc")),
                    np(jp(self.project.basedir, "dir_source"))
                ])
        finally:
            del sys.modules["sphinx"]
Ejemplo n.º 5
0
    def test_get_sphinx_apidoc_command_enabled(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock
        try:
            sphinx_mock.version_info = (1, 2, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(get_sphinx_apidoc_command(self.project),
                             ['sphinx.apidoc',
                              '-H',
                              'project_name',
                              '-o',
                              nc('basedir/dir_target/sphinx_pyb/apidoc'),
                              nc('basedir/dir_source')
                              ]
                             )
        finally:
            del sys.modules["sphinx"]
Ejemplo n.º 6
0
    def test_get_sphinx_apidoc_command_enabled_with_pep420(self):
        sphinx_mock = Mock()
        sys.modules["sphinx"] = sphinx_mock

        try:
            sphinx_mock.version_info = (1, 5, 3, 4, 5)

            self.project.set_property("sphinx_run_apidoc", True)
            self.project.set_property("dir_target", "dir_target")
            self.project.set_property("dir_source_main_python", "dir_source")
            self.project.set_property("sphinx_project_name", "project_name")

            self.assertEqual(get_sphinx_apidoc_command(self.project), [
                'sphinx.apidoc', '-H', 'project_name', '--implicit-namespaces',
                '-o',
                nc('basedir/dir_target/sphinx_pyb/apidoc'),
                nc('basedir/dir_source')
            ] if sys.version_info[:3] >= (3, 3) else [
                'sphinx.apidoc', '-H', 'project_name', '-o',
                nc('basedir/dir_target/sphinx_pyb/apidoc'),
                nc('basedir/dir_source')
            ])
        finally:
            del sys.modules["sphinx"]