Exemplo n.º 1
0
    def test_pdoc_html_adds_html_dir(self, exec_command, assert_can_exec, os_path_exists, os_mkdir):
        pdoc_init(self.project)
        self.project.set_property("pdoc_module_name", "pdoc_module_name_value")

        self.project.set_property("pdoc_command_args", [])
        pdoc_compile_docs(self.project, self.logger)
        exec_command.assert_called_with(['pdoc', "pdoc_module_name_value"],
                                        cwd=self.project.expand_path("$dir_target", "pdocs"),
                                        env={
                                            'PYTHONPATH': self.project.expand_path("$dir_source_main_python"),
                                            'PATH': os.environ['PATH']
                                        },
                                        outfile_name=self.project.expand_path('$dir_reports', 'pdoc'))

        self.project.set_property("pdoc_command_args", ["--html"])
        pdoc_compile_docs(self.project, self.logger)
        exec_command.assert_called_with(['pdoc', "--html", "--html-dir",
                                         self.project.expand_path('$dir_target', 'pdocs'),
                                         "pdoc_module_name_value"],
                                        cwd=self.project.expand_path("$dir_target", "pdocs"),
                                        env={
                                            'PYTHONPATH': self.project.expand_path("$dir_source_main_python"),
                                            'PATH': os.environ['PATH']
                                        },
                                        outfile_name=self.project.expand_path('$dir_reports', 'pdoc')
                                        )
Exemplo n.º 2
0
    def test_pdoc_html_adds_html_dir(self, exec_command, assert_can_exec,
                                     os_path_exists, os_mkdir):
        pdoc_init(self.project)
        self.project.set_property("pdoc_module_name", "pdoc_module_name_value")

        self.project.set_property("pdoc_command_args", [])
        pdoc_compile_docs(self.project, self.logger)
        exec_command.assert_called_with(
            ['pdoc', "pdoc_module_name_value"],
            cwd=self.project.expand_path("$dir_target", "pdocs"),
            env={
                'PYTHONPATH':
                self.project.expand_path("$dir_source_main_python"),
                'PATH': os.environ['PATH']
            },
            outfile_name=self.project.expand_path('$dir_reports', 'pdoc'))

        self.project.set_property("pdoc_command_args", ["--html"])
        pdoc_compile_docs(self.project, self.logger)
        exec_command.assert_called_with(
            [
                'pdoc', "--html", "--html-dir",
                self.project.expand_path('$dir_target', 'pdocs'),
                "pdoc_module_name_value"
            ],
            cwd=self.project.expand_path("$dir_target", "pdocs"),
            env={
                'PYTHONPATH':
                self.project.expand_path("$dir_source_main_python"),
                'PATH': os.environ['PATH']
            },
            outfile_name=self.project.expand_path('$dir_reports', 'pdoc'))
Exemplo n.º 3
0
    def test_pdoc_prepare_works(self, os_path_exists, os_mkdir):
        pdoc_init(self.project)

        os_path_exists.return_value = False
        pdoc_prepare(self.project, self.logger, self.reactor)
        self.assertEqual(os_mkdir.call_count, 1)

        os_path_exists.return_value = True
        pdoc_prepare(self.project, self.logger, self.reactor)
        self.assertEqual(os_mkdir.call_count, 1)

        self.assertEqual(self.reactor.pybuilder_venv.verify_can_execute.call_count, 2)
Exemplo n.º 4
0
    def test_pdoc_prepare_works(self, exec_command, assert_can_exec, os_path_exists, os_mkdir):
        pdoc_init(self.project)

        os_path_exists.return_value = False
        pdoc_prepare(self.project, self.logger)
        self.assertEquals(os_mkdir.call_count, 1)

        os_path_exists.return_value = True
        pdoc_prepare(self.project, self.logger)
        self.assertEquals(os_mkdir.call_count, 1)

        self.assertEquals(assert_can_exec.call_count, 2)
Exemplo n.º 5
0
    def test_pdoc_prepare_works(self, exec_command, assert_can_exec,
                                os_path_exists, os_mkdir):
        pdoc_init(self.project)

        os_path_exists.return_value = False
        pdoc_prepare(self.project, self.logger)
        self.assertEqual(os_mkdir.call_count, 1)

        os_path_exists.return_value = True
        pdoc_prepare(self.project, self.logger)
        self.assertEqual(os_mkdir.call_count, 1)

        self.assertEqual(assert_can_exec.call_count, 2)
Exemplo n.º 6
0
    def test_pdoc_html_adds_html_dir(self, *_):
        pdoc_init(self.project)
        self.project.set_property("pdoc_module_name", "pdoc_module_name_value")

        self.project.set_property("pdoc_command_args", [])
        pdoc_compile_docs(self.project, self.logger, self.reactor)
        pyb_env = self.reactor.pybuilder_venv
        pyb_env.execute_command.assert_called_with(
            ["pdoc", "pdoc_module_name_value"],
            cwd=self.project.expand_path("$dir_target", "pdocs"),
            env={
                "PYTHONPATH":
                self.project.expand_path("$dir_source_main_python"),
                "PATH": pyb_env.environ["PATH"]
            },
            outfile_name=self.project.expand_path("$dir_reports", "pdoc"),
            error_file_name=self.project.expand_path("$dir_reports",
                                                     "pdoc.err"))

        self.project.set_property("pdoc_command_args", ["--html"])
        pdoc_compile_docs(self.project, self.logger, self.reactor)
        pyb_env.execute_command.assert_called_with(
            [
                "pdoc", "--html", "--html-dir",
                self.project.expand_path("$dir_target", "pdocs"),
                "pdoc_module_name_value"
            ],
            cwd=self.project.expand_path("$dir_target", "pdocs"),
            env={
                "PYTHONPATH":
                self.project.expand_path("$dir_source_main_python"),
                "PATH": pyb_env.environ["PATH"]
            },
            outfile_name=self.project.expand_path("$dir_reports", "pdoc"),
            error_file_name=self.project.expand_path("$dir_reports",
                                                     "pdoc.err"))
Exemplo n.º 7
0
    def test_pdoc_requires_module_name(self, exec_command, assert_can_exec,
                                       os_path_exists, os_mkdir):
        pdoc_init(self.project)

        self.assertRaises(BuildFailedException, pdoc_compile_docs,
                          self.project, self.logger)
Exemplo n.º 8
0
    def test_pdoc_requires_module_name(self, *_):
        pdoc_init(self.project)

        self.assertRaises(BuildFailedException, pdoc_compile_docs,
                          self.project, self.logger, self.reactor)
Exemplo n.º 9
0
    def test_pdoc_requires_module_name(self, exec_command, assert_can_exec, os_path_exists, os_mkdir):
        pdoc_init(self.project)

        self.assertRaises(BuildFailedException, pdoc_compile_docs, self.project, self.logger)