diff --git a/docs/conf.py b/docs/conf.py index 1a7b1f3..449db98 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -82,7 +82,7 @@ # ## Extension: sphinx.ext.autodoc -autoclass_content = 'both' +autoclass_content = 'class' """ This value selects what content will be inserted into the main body of an autoclass directive. @@ -107,18 +107,42 @@ """ autodoc_default_options = { - #'exclude-members', + # Do not show these members. + # Note that documentation for `__init__` can still be added + # by setting `autoclass_content` to `both` or `init`. + 'exclude-members': '__dict__, __module__, __weakref__', + # Add all documented members. Boolean or 'var1, var2'. + 'members': True, + # Add dunder members. + 'special-members': True, + # Insert list of base classes. + 'show-inheritance': True, + # Include undocumented members + 'undoc-members': True, #'ignore-module-all', #'imported-members', #'inherited-members', - 'members': True, #'member-order', #'private-members', - #'special-members':, - #'show-inheritance', - 'undoc-members': True, } +autodoc_inherit_docstrings = False + +autodoc_typehints = 'description' +""" +How to represents typehints. + +The setting takes the following values: + +- 'signature': Show typehints as its signature (default) +- 'description': Show typehints as content of function or method +- 'none': Do not show typehints + +New in version 2.1. + +New in version 3.0: New option 'description' is added. +""" + # ## Extension: sphinx.ext.intersphinx intersphinx_mapping = { diff --git a/test_phile/test_PySide2_extras/test_posix_signal.py b/test_phile/test_PySide2_extras/test_posix_signal.py index 244cbec..5e23a08 100644 --- a/test_phile/test_PySide2_extras/test_posix_signal.py +++ b/test_phile/test_PySide2_extras/test_posix_signal.py @@ -43,15 +43,10 @@ def get_wakeup_fd() -> int: class TestInstallNoopSignalHandler(unittest.TestCase): """ - Unit test for + Tests :class:`~phile.PySide2_extras.posix_signal.install_noop_signal_handler`. """ - def __init__(self, *args, **kwargs): - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) - def setUp(self) -> None: """Remember the current signal handler to be restored later.""" self.sigint_handler = signal.getsignal(signal.SIGINT) @@ -80,15 +75,7 @@ def test_call(self) -> None: platform_can_handle_sigint, 'Cannot handle SIGINT on this platform.' ) class TestPosixSignal(unittest.TestCase): - """ - Unit test for - :class:`~phile.PySide2_extras.posix_signal.PosixSignal`. - """ - - def __init__(self, *args, **kwargs): - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.PySide2_extras.posix_signal.PosixSignal`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_PySide2_extras/test_watchdog_wrapper.py b/test_phile/test_PySide2_extras/test_watchdog_wrapper.py index c53a1b4..66c4564 100644 --- a/test_phile/test_PySide2_extras/test_watchdog_wrapper.py +++ b/test_phile/test_PySide2_extras/test_watchdog_wrapper.py @@ -32,15 +32,7 @@ class TestFileSystemSignalEmitter(unittest.TestCase): - """ - Unit test for :class:`~phile.PySide2_extras.FileSystemSignalEmitter`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.PySide2_extras.FileSystemSignalEmitter`.""" def setUp(self) -> None: """ @@ -161,13 +153,7 @@ def test_start_with_custom_observer(self) -> None: class TestFileSystemMonitor(unittest.TestCase): - """Unit test for :class:`~phile.PySide2_extras.FileSystemMonitor.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.PySide2_extras.FileSystemMonitor.""" def setUp(self) -> None: """ diff --git a/test_phile/test_configuration.py b/test_phile/test_configuration.py index 7e09272..9df9184 100644 --- a/test_phile/test_configuration.py +++ b/test_phile/test_configuration.py @@ -15,13 +15,7 @@ class TestConfiguration(unittest.TestCase): - """Unit test for :class:`~phile.tray.Configuration`.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.tray.Configuration`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_notify/test_cli.py b/test_phile/test_notify/test_cli.py index c6d498c..484eec8 100755 --- a/test_phile/test_notify/test_cli.py +++ b/test_phile/test_notify/test_cli.py @@ -24,13 +24,7 @@ class TestCreateArgumentParser(unittest.TestCase): - """Unit test for :func:`~phile.notify.cli.create_argument_parser`.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :func:`~phile.notify.cli.create_argument_parser`.""" def setUp(self) -> None: self.argument_parser = create_argument_parser() @@ -81,13 +75,7 @@ def test_write(self) -> None: class TestProcessArguments(unittest.TestCase): - """Unit test for :func:`~phile.notify.cli.process_arguments`.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :func:`~phile.notify.cli.process_arguments`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_notify/test_gui.py b/test_phile/test_notify/test_gui.py index 72b83b1..6981939 100755 --- a/test_phile/test_notify/test_gui.py +++ b/test_phile/test_notify/test_gui.py @@ -33,15 +33,7 @@ class TestNotificationMdiSubWindow(unittest.TestCase): - """ - Unit test for :class:`~phile.notify.gui.NotificationMdiSubWindow`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.notify.gui.NotificationMdiSubWindow`.""" def setUp(self) -> None: """ @@ -152,15 +144,7 @@ def test_closed_signal(self) -> None: class TestNotificationMdi(unittest.TestCase): - """ - Unit test for :class:`~phile.notify.gui.NotificationMdi`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.notify.gui.NotificationMdi`.""" def setUp(self) -> None: """ @@ -510,15 +494,7 @@ def test_resizeEvent_in_tabbed_view_mode(self) -> None: class TestMainWindow(unittest.TestCase): - """ - Unit test for :class:`~phile.notify.gui.MainWindow`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests for :class:`~phile.notify.gui.MainWindow`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_notify/test_notification.py b/test_phile/test_notify/test_notification.py index 8d6cbd2..ff75b3d 100644 --- a/test_phile/test_notify/test_notification.py +++ b/test_phile/test_notify/test_notification.py @@ -17,13 +17,7 @@ class TestNotification(unittest.TestCase): - """Unit test for :class:`~phile.notify.cli.Notification`.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.notify.cli.Notification`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_tray/test_gui.py b/test_phile/test_tray/test_gui.py index 2b631bf..35b46fe 100755 --- a/test_phile/test_tray/test_gui.py +++ b/test_phile/test_tray/test_gui.py @@ -32,13 +32,7 @@ class TestSetIconPaths(unittest.TestCase): - """Unit test for :class:`~phile.tray.set_icon_paths`.""" - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.tray.set_icon_paths`.""" def setUp(self) -> None: """ @@ -79,15 +73,7 @@ def test_call(self) -> None: class TestGuiIconList(unittest.TestCase): - """ - Unit test for :class:`~phile.tray.gui.GuiIconList`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.tray.gui.GuiIconList`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_tray/test_tmux.py b/test_phile/test_tray/test_tmux.py index 204ab4a..15078dc 100644 --- a/test_phile/test_tray/test_tmux.py +++ b/test_phile/test_tray/test_tmux.py @@ -41,17 +41,12 @@ class TestCommandBuilder(unittest.TestCase): """ - Unit test for :class:`~phile.tray.tmux.CommandBuilder`. + Tests :class:`~phile.tray.tmux.CommandBuilder`. Ensures the tmux command string returned from the class methods are as expected. """ - def __init__(self, *args, **kwargs) -> None: - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) - def test_exit_client(self) -> None: self.assertEqual(CommandBuilder.exit_client(), '') @@ -97,12 +92,7 @@ def test_set_global_status_right(self) -> None: class TestTimedeltaToSeconds(unittest.TestCase): - """Unit test for :class:`~phile.tray.tmux.timedelta_to_seconds`.""" - - def __init__(self, *args, **kwargs) -> None: - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.tray.tmux.timedelta_to_seconds`.""" def test_timedelta(self) -> None: """Convert :class:`~datetime.timedelta` to seconds.""" @@ -118,7 +108,7 @@ def test_none(self) -> None: class TestControlMode(unittest.TestCase): """ - Unit test for :class:`~phile.tray.tmux.ControlMode`. + Tests :class:`~phile.tray.tmux.ControlMode`. Also tests the functions :meth:`~phile.tray.tmux.get_server_pid` and :meth:`~phile.tray.tmux.kill_server`, @@ -132,11 +122,6 @@ class TestControlMode(unittest.TestCase): in :meth:`~TestControlMode.test_initialisation` as well. """ - def __init__(self, *args, **kwargs) -> None: - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) - def setUp(self) -> None: """ Create a tmux server instance before each method test. @@ -351,12 +336,7 @@ def test_function_kill_server_failing(self) -> None: class TestIconList(unittest.TestCase): - """Unit test for :class:`~phile.tray.tmux.IconList`.""" - - def __init__(self, *args, **kwargs) -> None: - """""" - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.tray.tmux.IconList`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_tray/test_tray_file.py b/test_phile/test_tray/test_tray_file.py index 2bb3641..e50535c 100644 --- a/test_phile/test_tray/test_tray_file.py +++ b/test_phile/test_tray/test_tray_file.py @@ -16,15 +16,7 @@ class TestTrayFile(unittest.TestCase): - """ - Unit test for :class:`~phile.notify.tray.TrayFile`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.notify.tray.TrayFile`.""" def setUp(self) -> None: """ diff --git a/test_phile/test_watchdog_extras.py b/test_phile/test_watchdog_extras.py index 9d65010..2a8b48a 100644 --- a/test_phile/test_watchdog_extras.py +++ b/test_phile/test_watchdog_extras.py @@ -25,15 +25,7 @@ class TestObserver(unittest.TestCase): - """ - Unit test for :class:`~phile.PySide2_extras.Observer`. - """ - - def __init__(self, *args, **kwargs) -> None: - """ - """ - # This method is created purely to overwrite default docstring. - super().__init__(*args, **kwargs) + """Tests :class:`~phile.PySide2_extras.Observer`.""" def setUp(self) -> None: """