示例#1
0
    def test_should_execute_command_regardless_of_verbose(self, exec_command):
        self.project.set_property("verbose", True)
        self.project.set_property("dir_target", "spam")
        initialize_sphinx_plugin(self.project)

        run_sphinx_build(["foo"], "bar", Mock(), self.project)
        self.assertEquals(exec_command.call_count, 1)
    def test_should_execute_command_regardless_of_verbose(self, exec_command):
        self.project.set_property("verbose", True)
        self.project.set_property("dir_target", "spam")
        initialize_sphinx_plugin(self.project)

        run_sphinx_build("foo", "bar", Mock(), self.project)
        self.assertEquals(exec_command.call_count, 1)
    def test_should_set_default_values_when_initializing_plugin(self):
        self.project.authors = [
            Author("John Doe", "*****@*****.**"),
            Author("Jane Doe", "*****@*****.**")]
        initialize_sphinx_plugin(self.project)

        self.project.set_property("sphinx_project_name", "foo")
        self.project.set_property("sphinx_project_version", "1.0")

        self.assertEquals(self.project.get_property("sphinx_source_dir"), "docs")
        self.assertEquals(self.project.get_property("sphinx_output_dir"), "docs/_build/")
        self.assertEquals(self.project.get_property("sphinx_config_path"), "docs")
        self.assertEquals(self.project.get_property("sphinx_doc_author"), 'John Doe, Jane Doe')
        self.assertEquals(self.project.get_property("sphinx_doc_builder"), "html")
        self.assertEquals(self.project.get_property("sphinx_project_name"), "foo")
        self.assertEquals(self.project.get_property("sphinx_project_version"), "1.0")
示例#4
0
    def test_should_leave_user_specified_properties_when_initializing_plugin(
            self):

        expected_properties = {
            "sphinx_source_dir": "source_dir",
            "sphinx_output_dir": "output_dir",
            "sphinx_config_path": "config_path",
            "sphinx_doc_author": "author",
            "sphinx_doc_builder": "doc_builder",
            "sphinx_project_name": "project_name",
            "sphinx_project_version": "project_version"
        }

        for property_name, property_value in expected_properties.items():
            self.project.set_property(property_name, property_value)

            initialize_sphinx_plugin(self.project)

        for property_name, property_value in expected_properties.items():
            self.assertEquals(self.project.get_property(property_name),
                              property_value)
    def test_should_leave_user_specified_properties_when_initializing_plugin(self):

        expected_properties = {
            "sphinx_source_dir": "source_dir",
            "sphinx_output_dir": "output_dir",
            "sphinx_config_path": "config_path",
            "sphinx_doc_author": "author",
            "sphinx_doc_builder": "doc_builder",
            "sphinx_project_name": "project_name",
            "sphinx_project_version": "project_version"
        }

        for property_name, property_value in expected_properties.items():
            self.project.set_property(property_name, property_value)

            initialize_sphinx_plugin(self.project)

        for property_name, property_value in expected_properties.items():
            self.assertEquals(

                self.project.get_property(property_name),
                property_value)
示例#6
0
    def test_should_set_default_values_when_initializing_plugin(self):
        self.project.authors = [
            Author("John Doe", "*****@*****.**"),
            Author("Jane Doe", "*****@*****.**")
        ]
        initialize_sphinx_plugin(self.project)

        self.project.set_property("sphinx_project_name", "foo")
        self.project.set_property("sphinx_project_version", "1.0")

        self.assertEquals(self.project.get_property("sphinx_source_dir"),
                          "docs")
        self.assertEquals(self.project.get_property("sphinx_output_dir"),
                          "docs/_build/")
        self.assertEquals(self.project.get_property("sphinx_config_path"),
                          "docs")
        self.assertEquals(self.project.get_property("sphinx_doc_author"),
                          'John Doe, Jane Doe')
        self.assertEquals(self.project.get_property("sphinx_doc_builder"),
                          "html")
        self.assertEquals(self.project.get_property("sphinx_project_name"),
                          "foo")
        self.assertEquals(self.project.get_property("sphinx_project_version"),
                          "1.0")