Loading .gitlab-ci.yml +8 −1 Original line number Diff line number Diff line Loading @@ -32,9 +32,16 @@ python3.9: variables: - $CORE_COMMIT_SHA # python3.11: # script: # - tox -e py311 # except: # variables: # - $CORE_COMMIT_SHA lint: script: - tox -e qa - tox -e lint except: variables: - $CORE_COMMIT_SHA Loading mypy.ini +1 −0 Original line number Diff line number Diff line [mypy] files = src/mailmanclient/asynclient.py,src/mailmanclient/asyncobjects/**.py,src/mailmanclient/restobjects/types.py,src/mailmanclient/restobjects/utils.py no_implicit_optional=False No newline at end of file setup.py +6 −5 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ # You should have received a copy of the GNU Lesser General Public License # along with mailman.client. If not, see <http://www.gnu.org/licenses/>. from setup_helpers import get_version, require_python from setuptools import setup, find_packages from setuptools import find_packages, setup from setup_helpers import get_version, require_python require_python(0x30500f0) require_python(0x30600f0) __version__ = get_version('src/mailmanclient/constants.py') Loading @@ -44,9 +44,10 @@ setup( classifiers=[ 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', # noqa 'Operating System :: POSIX', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Topic :: Internet :: WWW/HTTP ', ], install_requires=[ Loading src/mailmanclient/docs/using.rst +8 −10 Original line number Diff line number Diff line Loading @@ -424,9 +424,9 @@ The membership object's ``user`` attribute will return a User object: If you use an address which is not a member of test_two `ValueError` is raised: >>> test_two.unsubscribe('nomember@example.com') Traceback (most recent call last): ... >>> from mailmanclient.testing.documentation import print_exception >>> with print_exception(): ... test_two.unsubscribe('nomember@example.com') ValueError: nomember@example.com is not a member address of test-2@example.com After a while, Anna decides to unsubscribe from the Test One mailing list, Loading @@ -452,9 +452,8 @@ A little later, Cris decides to unsubscribe from the Test Two mailing list. If you try to unsubscribe an address which is not a member address `ValueError` is raised: >>> test_one.unsubscribe('nomember@example.com') Traceback (most recent call last): ... >>> with print_exception(): ... test_one.unsubscribe('nomember@example.com') ValueError: nomember@example.com is not a member address of test-1@example.com If we want to mass unsubscribe users. Loading Loading @@ -591,10 +590,9 @@ Trying to add an existing address will raise an error: ... display_name='Dana') >>> print(dana.display_name) Dana >>> cris.add_address('dana@example.org') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... HTTPError: HTTP Error 400: Address already exists >>> with print_exception(): ... cris.add_address('dana@example.org') # doctest: +IGNORE_EXCEPTION_DETAIL HTTPError: HTTP Error 400: Address belongs to other user This can be overridden by using the ``absorb_existing`` flag: Loading src/mailmanclient/testing/documentation.py +9 −2 Original line number Diff line number Diff line Loading @@ -17,9 +17,8 @@ """Harness for testing Mailman's documentation.""" from __future__ import absolute_import, print_function, unicode_literals from contextlib import contextmanager __metaclass__ = type __all__ = [ 'dump', ] Loading @@ -38,3 +37,11 @@ def dump(results): print(' {0}: {1}'.format(entry_key, entry[entry_key])) else: print('{0}: {1}'.format(key, results[key])) @contextmanager def print_exception(*args, **kw): try: yield except Exception as ex: print(f'{type(ex).__name__}: {ex}') Loading
.gitlab-ci.yml +8 −1 Original line number Diff line number Diff line Loading @@ -32,9 +32,16 @@ python3.9: variables: - $CORE_COMMIT_SHA # python3.11: # script: # - tox -e py311 # except: # variables: # - $CORE_COMMIT_SHA lint: script: - tox -e qa - tox -e lint except: variables: - $CORE_COMMIT_SHA Loading
mypy.ini +1 −0 Original line number Diff line number Diff line [mypy] files = src/mailmanclient/asynclient.py,src/mailmanclient/asyncobjects/**.py,src/mailmanclient/restobjects/types.py,src/mailmanclient/restobjects/utils.py no_implicit_optional=False No newline at end of file
setup.py +6 −5 Original line number Diff line number Diff line Loading @@ -15,11 +15,11 @@ # You should have received a copy of the GNU Lesser General Public License # along with mailman.client. If not, see <http://www.gnu.org/licenses/>. from setup_helpers import get_version, require_python from setuptools import setup, find_packages from setuptools import find_packages, setup from setup_helpers import get_version, require_python require_python(0x30500f0) require_python(0x30600f0) __version__ = get_version('src/mailmanclient/constants.py') Loading @@ -44,9 +44,10 @@ setup( classifiers=[ 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', # noqa 'Operating System :: POSIX', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Topic :: Internet :: WWW/HTTP ', ], install_requires=[ Loading
src/mailmanclient/docs/using.rst +8 −10 Original line number Diff line number Diff line Loading @@ -424,9 +424,9 @@ The membership object's ``user`` attribute will return a User object: If you use an address which is not a member of test_two `ValueError` is raised: >>> test_two.unsubscribe('nomember@example.com') Traceback (most recent call last): ... >>> from mailmanclient.testing.documentation import print_exception >>> with print_exception(): ... test_two.unsubscribe('nomember@example.com') ValueError: nomember@example.com is not a member address of test-2@example.com After a while, Anna decides to unsubscribe from the Test One mailing list, Loading @@ -452,9 +452,8 @@ A little later, Cris decides to unsubscribe from the Test Two mailing list. If you try to unsubscribe an address which is not a member address `ValueError` is raised: >>> test_one.unsubscribe('nomember@example.com') Traceback (most recent call last): ... >>> with print_exception(): ... test_one.unsubscribe('nomember@example.com') ValueError: nomember@example.com is not a member address of test-1@example.com If we want to mass unsubscribe users. Loading Loading @@ -591,10 +590,9 @@ Trying to add an existing address will raise an error: ... display_name='Dana') >>> print(dana.display_name) Dana >>> cris.add_address('dana@example.org') # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): ... HTTPError: HTTP Error 400: Address already exists >>> with print_exception(): ... cris.add_address('dana@example.org') # doctest: +IGNORE_EXCEPTION_DETAIL HTTPError: HTTP Error 400: Address belongs to other user This can be overridden by using the ``absorb_existing`` flag: Loading
src/mailmanclient/testing/documentation.py +9 −2 Original line number Diff line number Diff line Loading @@ -17,9 +17,8 @@ """Harness for testing Mailman's documentation.""" from __future__ import absolute_import, print_function, unicode_literals from contextlib import contextmanager __metaclass__ = type __all__ = [ 'dump', ] Loading @@ -38,3 +37,11 @@ def dump(results): print(' {0}: {1}'.format(entry_key, entry[entry_key])) else: print('{0}: {1}'.format(key, results[key])) @contextmanager def print_exception(*args, **kw): try: yield except Exception as ex: print(f'{type(ex).__name__}: {ex}')