Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mwic for openSUSE:Factory checked in at 2023-01-20 17:38:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mwic (Old) and /work/SRC/openSUSE:Factory/.mwic.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mwic" Fri Jan 20 17:38:56 2023 rev:7 rq:1059865 version:0.7.9 Changes: -------- --- /work/SRC/openSUSE:Factory/mwic/mwic.changes 2020-04-07 10:32:25.714585136 +0200 +++ /work/SRC/openSUSE:Factory/.mwic.new.32243/mwic.changes 2023-01-20 17:39:12.676697470 +0100 @@ -1,0 +2,13 @@ +Sun Jan 15 21:05:16 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.7.9: + * Add new multi-word misspellings to the dictionary. + * Fix printing PyEnchant version. + * Improve mwic4po: + + Improve error handling. + + Use uppercase for CLI metavar. + * Drop support for Python < 3.6. + * Update Docutils homepage URL. + * Make it possible use pytest as the test harness. + +------------------------------------------------------------------- Old: ---- mwic-0.7.8.tar.gz mwic-0.7.8.tar.gz.asc New: ---- mwic-0.7.9.tar.gz mwic-0.7.9.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mwic.spec ++++++ --- /var/tmp/diff_new_pack.wXRimt/_old 2023-01-20 17:39:13.872704085 +0100 +++ /var/tmp/diff_new_pack.wXRimt/_new 2023-01-20 17:39:13.876704107 +0100 @@ -1,7 +1,7 @@ # # spec file for package mwic # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{!?license: %global license %doc} Name: mwic -Version: 0.7.8 +Version: 0.7.9 Release: 0 Summary: A spellchecker with grouping support License: MIT ++++++ mwic-0.7.8.tar.gz -> mwic-0.7.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/.pylintrc new/mwic-0.7.9/.pylintrc --- old/mwic-0.7.8/.pylintrc 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/.pylintrc 2022-04-25 14:33:14.000000000 +0200 @@ -12,6 +12,7 @@ locally-disabled, no-else-continue, no-self-use, + raise-missing-from, redefined-variable-type, similarities, too-few-public-methods, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/dict/en new/mwic-0.7.9/dict/en --- old/mwic-0.7.8/dict/en 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/dict/en 2022-04-25 14:33:14.000000000 +0200 @@ -195,6 +195,9 @@ # regarding to X â regarding X regarding to +# more that â more than +(more|less|larger|bigger|smaller|faster|slower) that(?! way) + # an â a an Unicode an unary diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/doc/LICENSE new/mwic-0.7.9/doc/LICENSE --- old/mwic-0.7.8/doc/LICENSE 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/doc/LICENSE 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> +Copyright © 2012-2022 Jakub Wilk <jw...@jwilk.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the âSoftwareâ), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/doc/README new/mwic-0.7.9/doc/README --- old/mwic-0.7.8/doc/README 2019-11-16 18:11:57.000000000 +0100 +++ new/mwic-0.7.9/doc/README 2022-04-25 14:33:17.000000000 +0200 @@ -11,7 +11,7 @@ The following software is needed to run mwic: -* Python ⥠3.3; +* Python ⥠3.6; * PyEnchant_, Python bindings for the Enchant_ spellchecking system; @@ -41,6 +41,6 @@ .. _Enchant: https://abiword.github.io/enchant/ .. _docutils: - http://docutils.sourceforge.net/ + https://docutils.sourceforge.io/ .. vim:ts=3 sts=3 sw=3 ft=rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/doc/changelog new/mwic-0.7.9/doc/changelog --- old/mwic-0.7.8/doc/changelog 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/doc/changelog 2022-04-25 14:33:14.000000000 +0200 @@ -1,3 +1,16 @@ +mwic (0.7.9) unstable; urgency=low + + * Add new multi-word misspellings to the dictionary. + * Fix printing PyEnchant version. + * Improve mwic4po: + + Improve error handling. + + Use uppercase for CLI metavar. + * Drop support for Python < 3.6. + * Update Docutils homepage URL. + * Make it possible use pytest as the test harness. + + -- Jakub Wilk <jw...@jwilk.net> Mon, 25 Apr 2022 14:33:05 +0200 + mwic (0.7.8) unstable; urgency=low * Add new multi-word misspellings to the dictionary. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/doc/manpage.rst new/mwic-0.7.9/doc/manpage.rst --- old/mwic-0.7.8/doc/manpage.rst 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/doc/manpage.rst 2022-04-25 14:33:14.000000000 +0200 @@ -7,8 +7,8 @@ --------------------------- :manual section: 1 -:version: mwic 0.7.8 -:date: 2018-11-14 +:version: mwic 0.7.9 +:date: 2022-04-25 Synopsis -------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/doc/mwic.1 new/mwic-0.7.9/doc/mwic.1 --- old/mwic-0.7.8/doc/mwic.1 2019-11-16 18:11:58.000000000 +0100 +++ new/mwic-0.7.9/doc/mwic.1 2022-04-25 14:33:19.000000000 +0200 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH MWIC 1 "2018-11-14" "mwic 0.7.8" "" +.TH MWIC 1 "2022-04-25" "mwic 0.7.9" "" .SH NAME mwic \- Misspelled Words In Context . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/lib/__init__.py new/mwic-0.7.9/lib/__init__.py --- old/mwic-0.7.8/lib/__init__.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/lib/__init__.py 2022-04-25 14:33:14.000000000 +0200 @@ -2,4 +2,4 @@ mwic's private modules ''' -type(lambda: (yield from [])) # Python >= 3.3 is required +type(0_0) # Python >= 3.6 is required diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/lib/cli.py new/mwic-0.7.9/lib/cli.py --- old/mwic-0.7.8/lib/cli.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/lib/cli.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2013-2019 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2013-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -41,7 +41,7 @@ from . import text # pylint: enable=import-outside-toplevel -__version__ = '0.7.8' +__version__ = '0.7.9' class VersionAction(argparse.Action): @@ -54,9 +54,10 @@ ) def __call__(self, parser, namespace, values, option_string=None): - print('{prog} {0}'.format(__version__, prog=parser.prog)) + # pylint: disable=consider-using-f-string + print(f'{parser.prog} {__version__}') print('+ Python {0}.{1}.{2}'.format(*sys.version_info)) - print('+ PyEnchant {0}'.format(__version__)) + print(f'+ PyEnchant {enchant.__version__}') try: enchant_version = enchant.get_enchant_version() except AttributeError: @@ -64,9 +65,9 @@ else: if isinstance(enchant_version, bytes): enchant_version = enchant_version.decode('ASCII', 'replace') - print(' + Enchant {0}'.format(enchant_version)) + print(f' + Enchant {enchant_version}') regex = lib.intdict.re - print('+ regex {0}'.format(regex.__version__)) # pylint: disable=no-member + print(f'+ regex {regex.__version__}') # pylint: disable=no-member parser.exit() def main(): @@ -127,7 +128,7 @@ else: dictvars = vars(dictionary).items() for key, value in sorted(dictvars): - print('{k} = {v!r}'.format(k=key, v=value)) + print(f'{key} = {value!r}') sys.exit(0) intdict = lib.intdict.Dictionary(options.language) extdict = lib.extdict.Dictionary(*options.blacklist) @@ -155,7 +156,7 @@ ) else: try: - file = open( + file = open( # pylint: disable=consider-using-with path, 'rt', encoding=encoding, errors=enc_errors, @@ -163,7 +164,7 @@ except OSError as exc: if options.traceback: raise - msg = '{prog}: {path}: {exc}'.format(prog=ap.prog, path=path, exc=exc.strerror) + msg = f'{ap.prog}: {path}: {exc.strerror}' print(msg, file=sys.stderr) rc = 1 continue @@ -235,7 +236,8 @@ if options.suggest > 0: suggestions = ctxt.dictionary.suggest(word)[:options.suggest] if suggestions: - extra = ' ({sug})'.format(sug=', '.join(suggestions)) + suggestions = str.join(', ', suggestions) + extra = f' ({suggestions})' print(word + extra + ':') highlight_color = 'error' if occurrences.certainty > 0 else 'warn' occurrences = [ @@ -257,11 +259,7 @@ print(lib.colors.dim('|'), end=' ') else: print('|', end=' ') - print('{lc}{word}{rc}'.format( - lc=lcontext, - word=word, - rc=rcontext, - )) + print(f'{lcontext}{word}{rcontext}') if options.output_format != 'color': print('', ' ' * lwidth, '^' * len(word)) if not options.compact: @@ -284,7 +282,8 @@ if options.suggest > 0: suggestions = ctxt.dictionary.suggest(word)[:options.suggest] if suggestions: - extra = ' ({sug})'.format(sug=', '.join(suggestions)) + suggestions = str.join(', ', suggestions) + extra = f' ({suggestions})' header += [word + extra] for x in positions: underline[x : x + len(word)] = underline_char * len(word) @@ -321,7 +320,7 @@ print() class list_languages(argparse.Action): - def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ + def __call__(self, *args, **kwargs): # pylint: disable=arguments-differ,signature-differs for lang in sorted(enchant.list_languages()): print(lang) sys.exit(0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/lib/colors.py new/mwic-0.7.9/lib/colors.py --- old/mwic-0.7.8/lib/colors.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/lib/colors.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2015-2019 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -55,8 +55,8 @@ if cs < ' ' or cs == '\x7F': cs = '^' + chr(ord(cs) ^ ord('@')) else: - cs = '<U+{0:04X}>'.format(ord(cs)) - cs = '{t.reverse}{c}{t.unreverse}'.format(c=cs, t=_seq) + cs = f'<U+{ord(cs):04X}>' + cs = f'{_seq.reverse}{cs}{_seq.unreverse}' fp.write(cs) if old_color != off: fp.write(off) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/lib/intdict.py new/mwic-0.7.9/lib/intdict.py --- old/mwic-0.7.8/lib/intdict.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/lib/intdict.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -66,7 +66,7 @@ regex = [] for i, (name, definition) in enumerate(self._defs.items()): substs += [definition] - regex += ['(?P<mwic{i}>{name})'.format(i=i, name=re.escape(name))] + regex += [f'(?P<mwic{i}>{re.escape(name)})'] regex = '|'.join(regex) regex = re.compile(regex) self._regex = regex @@ -75,7 +75,7 @@ assert self._substs is not None def replace(match): for i, subst in enumerate(substs): - if match.group('mwic{i}'.format(i=i)) is not None: + if match.group(f'mwic{i}') is not None: return subst assert False # no coverage return self._regex.sub(replace, s) @@ -89,7 +89,7 @@ while True: path = os.path.join(datadir, lang) try: - file = open(path, 'rt', encoding='UTF-8') + file = open(path, 'rt', encoding='UTF-8') # pylint: disable=consider-using-with except FileNotFoundError: [lang, *suffix] = lang.rsplit('-', 1) if suffix: @@ -116,7 +116,8 @@ elif line[0][0] == '@': if (len(line) >= 4) and (line[0] == '@define') and (line[2] == '='): (_, name, _, *definition) = line - definition = r'(?:{re})'.format(re=r'\s+'.join(definition)) + definition = str.join(r'\s+', definition) + definition = fr'(?:{definition})' try: re.compile(definition) except re.error as exc: # no coverage @@ -124,7 +125,7 @@ try: macros[name] = macros.expand(definition) # pylint: disable=unsubscriptable-object except KeyError: # no coverage - raise error('duplicate macro definition: {}'.format(name)) + raise error(f'duplicate macro definition: {name}') else: raise error('malformed @-command') # no coverage else: @@ -137,9 +138,8 @@ regexes += [regex] break if regexes: - regex = r'\b(?:(?i){0})\b'.format( - '|'.join(regexes) - ) + regex = str.join('|', regexes) + regex = fr'\b(?:(?i){regex})\b' self._find = re.compile(regex).finditer else: self._find = _find_nothing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/lib/pager.py new/mwic-0.7.9/lib/pager.py --- old/mwic-0.7.8/lib/pager.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/lib/pager.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2021 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -61,8 +61,7 @@ env = dict(env or os.environ, LV='-c') orig_stdout = sys.stdout try: - pager = ipc.Popen(cmdline, shell=True, stdin=ipc.PIPE, env=env) - try: + with ipc.Popen(cmdline, shell=True, stdin=ipc.PIPE, env=env) as pager: sys.stdout = io.TextIOWrapper(pager.stdin, encoding=orig_stdout.encoding, ) @@ -70,8 +69,6 @@ yield finally: sys.stdout.close() - finally: - pager.wait() finally: sys.stdout = orig_stdout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/misc/mwic4po new/mwic-0.7.9/misc/mwic4po --- old/mwic-0.7.8/misc/mwic4po 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/misc/mwic4po 2022-04-25 14:33:14.000000000 +0200 @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright © 2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2016-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -22,15 +22,16 @@ set -e -u -prog=$(basename "$0") +prog=${0##*/} if [ $# -ne 1 ] then - printf 'Usage: %s <pofile>\n' "$prog" >&2 + printf 'Usage: %s PO-FILE\n' "$prog" >&2 exit 1 fi pofile="$1" +exec 3<"$pofile" lang=$( - msggrep -K -e '^$' --force-po < "$pofile" \ + msggrep -K -e '^$' --force-po <&3 \ | msgexec cat \ | sed -n -e 's/^Language: *//p' ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/private/check-rst new/mwic-0.7.9/private/check-rst --- old/mwic-0.7.8/private/check-rst 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/private/check-rst 2022-04-25 14:33:14.000000000 +0200 @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright © 2016-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2016-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -37,6 +37,6 @@ else printf '%s\n' "$@" fi | -xargs -L1 -t -I{} "$rst2xml" $options {} /dev/null +xargs -t -I{} "$rst2xml" $options {} /dev/null # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/__init__.py new/mwic-0.7.9/tests/__init__.py --- old/mwic-0.7.8/tests/__init__.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/__init__.py 2022-04-25 14:33:14.000000000 +0200 @@ -1 +1 @@ -type(...) # Python >= 3 is required +type(0_0) # Python >= 3.6 is required diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/multiword-more-that.exp new/mwic-0.7.9/tests/multiword-more-that.exp --- old/mwic-0.7.8/tests/multiword-more-that.exp 1970-01-01 01:00:00.000000000 +0100 +++ new/mwic-0.7.9/tests/multiword-more-that.exp 2022-04-25 14:33:14.000000000 +0200 @@ -0,0 +1,28 @@ +bigger that: +| X is bigger that Y. + ^^^^^^^^^^^ + +faster that: +| X is faster that Y. + ^^^^^^^^^^^ + +larger that: +| X is larger that Y. + ^^^^^^^^^^^ + +less that: +| X is less that Y. + ^^^^^^^^^ + +more that: +| X is more that Y. + ^^^^^^^^^ + +slower that: +| X is slower that Y. + ^^^^^^^^^^^ + +smaller that: +| X is smaller that Y. + ^^^^^^^^^^^^ + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/multiword-more-that.txt new/mwic-0.7.9/tests/multiword-more-that.txt --- old/mwic-0.7.8/tests/multiword-more-that.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/mwic-0.7.9/tests/multiword-more-that.txt 2022-04-25 14:33:14.000000000 +0200 @@ -0,0 +1,17 @@ +X is more that Y. +X is less that Y. +X is larger that Y. +X is bigger that Y. +X is smaller that Y. +X is faster that Y. +X is slower that Y. + +X is more than Y. +X is less than Y. +X is larger than Y. +X is bigger than Y. +X is smaller than Y. +X is faster than Y. +X is slower than Y. + +It's faster that way. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/run-tests new/mwic-0.7.9/tests/run-tests --- old/mwic-0.7.8/tests/run-tests 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/run-tests 2022-04-25 14:33:14.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright © 2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2016-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -29,6 +29,6 @@ from tests import test_blackbox if __name__ == '__main__': - nose.main(addplugins=[test_blackbox.Plugin()]) + nose.main(addplugins=[test_blackbox.nose_plugin()]) # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_blackbox.py new/mwic-0.7.9/tests/test_blackbox.py --- old/mwic-0.7.8/tests/test_blackbox.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_blackbox.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2014-2019 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2014-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -24,14 +24,11 @@ import sys import unittest.mock -import nose -from nose.tools import ( - assert_multi_line_equal, -) - import lib.cli as M -assert_multi_line_equal.__self__.maxDiff = None # pylint: disable=no-member +from .tools import ( + assert_multi_line_equal, +) here = os.path.dirname(__file__) here = os.path.relpath(here) @@ -66,7 +63,7 @@ if expected != text: altxpath = xpath[:-4] + '.alt' try: - file = open(altxpath, 'rt', encoding='UTF-8') + file = open(altxpath, 'rt', encoding='UTF-8') # pylint: disable=consider-using-with except FileNotFoundError: pass else: @@ -76,43 +73,69 @@ expected = alt_expected assert_multi_line_equal(expected, text) -def test_text(): - for xpath in glob.glob(here + '/*.exp'): - yield _test_text, xpath -test_text.redundant = True # not needed if the plugin is enabled +class TestText(unittest.TestCase): + + def __str__(self): + return self._testMethodName.split("'")[1] -class Plugin(nose.plugins.Plugin): + @classmethod + def _add_test(cls, xpath): + def method(self): + del self + return _test_text(xpath) + name = f'test[{xpath!r}]' + pytest = sys.modules.get('pytest') + if pytest and int(pytest.__version__.split('.', 1)[0]) < 6: + # pytest before 6.0 doesn't like "[" in the test name + # https://github.com/pytest-dev/pytest/commit/8b9b81c3c04399d0 + name = name.replace('[', '(').replace(']', ')') + method.__name__ = name + setattr(cls, name, method) + + @classmethod + def _add_tests(cls, xpaths): + for xpath in xpaths: + cls._add_test(xpath) + +TestText._add_tests(glob.glob(here + '/*.exp')) # pylint: disable=protected-access + +def nose_plugin(): - name = 'mwic-plugin' - enabled = True + import nose.plugins # pylint: disable=import-outside-toplevel - def options(self, parser, env): - pass + class Plugin(nose.plugins.Plugin): - def wantFile(self, path): - abs_here = os.path.abspath(here) - abs_here = os.path.join(abs_here, '') - if path.startswith(abs_here) and path.endswith('.exp'): - return True + name = 'mwic-plugin' + enabled = True - def loadTestsFromFile(self, path): - if self.wantFile(path): - yield TestCase(path) + def options(self, parser, env): + pass - def wantFunction(self, func): - if getattr(func, 'redundant', False): - return False + def wantFile(self, path): + abs_here = os.path.abspath(here) + abs_here = os.path.join(abs_here, '') + if path.startswith(abs_here) and path.endswith('.exp'): + return True -class TestCase(unittest.TestCase): + def loadTestsFromFile(self, path): + if self.wantFile(path): + yield TestCase(path) - def __init__(self, path): - super().__init__('_test') - self.path = os.path.relpath(path) + def wantClass(self, cls): + return f'{cls.__module__}.{cls.__name__}' != 'tests.test_blackbox.TestText' - def _test(self): - _test_text(self.path) + class TestCase(unittest.TestCase): - def __str__(self): - return self.path + def __init__(self, path): + super().__init__('_test') + self.path = os.path.relpath(path) + + def _test(self): + _test_text(self.path) + + def __str__(self): + return self.path + + return Plugin() # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_camel_case.py new/mwic-0.7.9/tests/test_camel_case.py --- old/mwic-0.7.8/tests/test_camel_case.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_camel_case.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2016-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -18,12 +18,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from nose.tools import ( +import lib.text as M + +from .tools import ( assert_equal, ) -import lib.text as M - def naive_tokenizer(s): offset = 0 for word in s.split(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_cli.py new/mwic-0.7.9/tests/test_cli.py --- old/mwic-0.7.8/tests/test_cli.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_cli.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2019 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2019-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -22,14 +22,14 @@ import io import unittest.mock -from nose.tools import ( +import lib.cli + +from .tools import ( assert_equal, assert_is_instance, assert_not_equal, ) -import lib.cli - def test_version_action(): action = lib.cli.VersionAction(['--version']) stdout = io.StringIO() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_colors.py new/mwic-0.7.9/tests/test_colors.py --- old/mwic-0.7.8/tests/test_colors.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_colors.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -21,12 +21,12 @@ import io import unittest.mock -from nose.tools import ( +from lib import colors as M + +from .tools import ( assert_equal, ) -from lib import colors as M - def with_stdout(encoding): stdout = io.TextIOWrapper( io.BytesIO(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_extdict.py new/mwic-0.7.9/tests/test_extdict.py --- old/mwic-0.7.8/tests/test_extdict.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_extdict.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2016-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -22,12 +22,13 @@ import functools import tempfile -from nose.tools import ( +import lib.extdict as M + +from .tools import ( assert_in, assert_not_in, ) -import lib.extdict as M @contextlib.contextmanager def tmpdict(data): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_trim.py new/mwic-0.7.9/tests/test_trim.py --- old/mwic-0.7.8/tests/test_trim.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_trim.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2014-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2014-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -18,13 +18,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from nose.tools import ( +import lib.text as M + +from .tools import ( assert_equal, assert_greater_equal, ) -import lib.text as M - def test_ltrim(): def t(s, n, expected): result = M.ltrim(s, n) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/test_version.py new/mwic-0.7.9/tests/test_version.py --- old/mwic-0.7.8/tests/test_version.py 2019-11-16 18:11:55.000000000 +0100 +++ new/mwic-0.7.9/tests/test_version.py 2022-04-25 14:33:14.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2015 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2022 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the âSoftwareâ), to deal @@ -20,12 +20,12 @@ import os -from nose.tools import ( +from lib.cli import __version__ + +from .tools import ( assert_equal, ) -from lib.cli import __version__ - here = os.path.dirname(__file__) docdir = os.path.join(here, os.pardir, 'doc') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mwic-0.7.8/tests/tools.py new/mwic-0.7.9/tests/tools.py --- old/mwic-0.7.8/tests/tools.py 1970-01-01 01:00:00.000000000 +0100 +++ new/mwic-0.7.9/tests/tools.py 2022-04-25 14:33:14.000000000 +0200 @@ -0,0 +1,37 @@ +# Copyright © 2022 Jakub Wilk <jw...@jwilk.net> +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the âSoftwareâ), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED âAS ISâ, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +import unittest + +tc = unittest.TestCase('__hash__') + +assert_equal = tc.assertEqual +assert_greater_equal = tc.assertGreaterEqual +assert_in = tc.assertIn +assert_is_instance = tc.assertIsInstance +assert_multi_line_equal = tc.assertMultiLineEqual +assert_not_equal = tc.assertNotEqual +assert_not_in = tc.assertNotIn + +del tc + +assert_multi_line_equal.__self__.maxDiff = None # pylint: disable=no-member + +# vim:ts=4 sts=4 sw=4 et