From 1c19d389bbf5894a0bf451e2fc9ddace4317661a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 25 Apr 2018 14:03:32 -0700 Subject: [PATCH] *: Drop nose dependency And use Python's unittest discovery instead. The load_tests link between the doctests and unittest is based on [1]. [1]: https://docs.python.org/3.6/library/doctest.html#unittest-api --- README | 14 ++++++-------- pyassuan/test_common.py | 25 +++++++++++++++++++++++++ pyassuan/test_error.py | 25 +++++++++++++++++++++++++ pyassuan/test_server.py | 25 +++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 pyassuan/test_common.py create mode 100644 pyassuan/test_error.py create mode 100644 pyassuan/test_server.py diff --git a/README b/README index 5c5bcc3..613c90c 100644 --- a/README +++ b/README @@ -50,20 +50,17 @@ Checkout the docstrings and the examples in ``bin``. Testing ======= -Run the internal unit tests using nose_:: +Run the internal unit tests with `Python 3.2+'s unittest discovery`__:: - $ nosetests --with-doctest --doctest-tests pyassuan - -If a Python-3-version of ``nosetests`` is not the default on your -system, you may need to try something like:: - - $ nosetests-3.3 --with-doctest --doctest-tests pyassuan + $ python -m unittest discover To test running servers by hand, you can use `gpg-connect-agent`_. Despite the name, this program can connect to any Assuan server:: $ gpg-connect-agent --raw-socket name +__ unittest-discovery_ + Licence ======= @@ -87,7 +84,8 @@ wking@tremily.us .. _wtk overlay: http://blog.tremily.us/posts/Gentoo_overlay/ .. _Git: http://git-scm.com/ .. _homepage: http://blog.tremily.us/posts/pyassuan/ -.. _nose: http://readthedocs.org/docs/nose/en/latest/ .. _gpg-connect-agent: http://www.gnupg.org/documentation/manuals/gnupg-devel/gpg_002dconnect_002dagent.html +.. _unittest-discovery: + https://docs.python.org/3.5/library/unittest.html#unittest-test-discovery .. _GNU General Public License Version 3: http://www.gnu.org/licenses/gpl.html diff --git a/pyassuan/test_common.py b/pyassuan/test_common.py new file mode 100644 index 0000000..1f9d7dd --- /dev/null +++ b/pyassuan/test_common.py @@ -0,0 +1,25 @@ +# Copyright (C) 2018 W. Trevor King +# +# This file is part of pyassuan. +# +# pyassuan is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# pyassuan is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# pyassuan. If not, see . + +import doctest +import unittest + +from . import common + + +def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(common)) + return tests diff --git a/pyassuan/test_error.py b/pyassuan/test_error.py new file mode 100644 index 0000000..f2cc0f5 --- /dev/null +++ b/pyassuan/test_error.py @@ -0,0 +1,25 @@ +# Copyright (C) 2018 W. Trevor King +# +# This file is part of pyassuan. +# +# pyassuan is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# pyassuan is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# pyassuan. If not, see . + +import doctest +import unittest + +from . import error + + +def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(error)) + return tests diff --git a/pyassuan/test_server.py b/pyassuan/test_server.py new file mode 100644 index 0000000..bd70225 --- /dev/null +++ b/pyassuan/test_server.py @@ -0,0 +1,25 @@ +# Copyright (C) 2018 W. Trevor King +# +# This file is part of pyassuan. +# +# pyassuan is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# pyassuan is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# pyassuan. If not, see . + +import doctest +import unittest + +from . import server + + +def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(server)) + return tests -- 2.26.2