Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-knack for openSUSE:Factory 
checked in at 2021-05-11 23:04:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-knack (Old)
 and      /work/SRC/openSUSE:Factory/.python-knack.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-knack"

Tue May 11 23:04:04 2021 rev:16 rq:892151 version:0.8.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-knack/python-knack.changes        
2021-04-01 14:18:23.168080376 +0200
+++ /work/SRC/openSUSE:Factory/.python-knack.new.2988/python-knack.changes      
2021-05-11 23:04:08.796961450 +0200
@@ -1,0 +2,9 @@
+Mon May 10 08:39:40 UTC 2021 - John Paul Adrian Glaubitz 
<[email protected]>
+
+- Update to version 0.8.2
+  * Always use UTF-8 for log file encoding (#247)
+- from version 0.8.1
+  * Add error message for invalid argument value (#244)
+- Remove temporary version override
+
+-------------------------------------------------------------------
@@ -4,4 +13,7 @@
-- New upstream release
-  + Version 0.8.0
-  + For detailed information about changes see the
-    CHANGELOG.md file provided with this package
+- Update to version 0.8.0
+  * Make colors customizable (#242)
+  * Init colorama only in Windows legacy terminal (#238)
+  * Add `raw_result` to `CommandResultItem` (#235)
+  * Refine code style to comply with Python 3 (#232, #233)
+  * CI: Support Python 3.9 (#229)
+  * Logging: `CLILogging.configure` returns as early as possible (#228)

Old:
----
  knack-0.8.0.tar.gz

New:
----
  knack-0.8.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-knack.spec ++++++
--- /var/tmp/diff_new_pack.4hVQtM/_old  2021-05-11 23:04:09.252959370 +0200
+++ /var/tmp/diff_new_pack.4hVQtM/_new  2021-05-11 23:04:09.256959351 +0200
@@ -16,18 +16,16 @@
 #
 
 
-%define realversion 0.8.0
-
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-knack
-Version:        0.8.0.0
+Version:        0.8.2
 Release:        0
 Summary:        A Command-Line Interface framework
 License:        MIT
 Group:          Development/Languages/Python
 URL:            https://github.com/microsoft/knack
-Source:         
https://files.pythonhosted.org/packages/source/k/knack/knack-%{realversion}.tar.gz
+Source:         
https://files.pythonhosted.org/packages/source/k/knack/knack-%{version}.tar.gz
 BuildRequires:  %{python_module PyYAML}
 BuildRequires:  %{python_module argcomplete}
 BuildRequires:  %{python_module colorama}
@@ -53,7 +51,7 @@
 A Command-Line Interface framework
 
 %prep
-%setup -q -n knack-%{realversion}
+%setup -q -n knack-%{version}
 
 %build
 %python_build

++++++ knack-0.8.0.tar.gz -> knack-0.8.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/HISTORY.rst new/knack-0.8.2/HISTORY.rst
--- old/knack-0.8.0/HISTORY.rst 2021-03-26 07:10:52.000000000 +0100
+++ new/knack-0.8.2/HISTORY.rst 2021-05-08 08:50:44.000000000 +0200
@@ -3,6 +3,16 @@
 Release History
 ===============
 
+0.8.2
++++++
+
+* Always use UTF-8 for log file encoding (#247)
+
+0.8.1
++++++
+
+* Add error message for invalid argument value (#244)
+
 0.8.0
 +++++
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/PKG-INFO new/knack-0.8.2/PKG-INFO
--- old/knack-0.8.0/PKG-INFO    2021-03-26 07:10:57.000000000 +0100
+++ new/knack-0.8.2/PKG-INFO    2021-05-08 08:50:47.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: knack
-Version: 0.8.0
+Version: 0.8.2
 Summary: A Command-Line Interface framework
 Home-page: https://github.com/microsoft/knack
 Author: Microsoft Corporation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/knack/log.py new/knack-0.8.2/knack/log.py
--- old/knack-0.8.0/knack/log.py        2021-03-26 07:10:52.000000000 +0100
+++ new/knack-0.8.2/knack/log.py        2021-05-08 08:50:44.000000000 +0200
@@ -16,6 +16,8 @@
 # without --debug flag.
 cli_logger_names = [CLI_LOGGER_NAME]
 
+LOG_FILE_ENCODING = 'utf-8'
+
 
 class CliLogLevel(IntEnum):
     CRITICAL = 0
@@ -163,7 +165,8 @@
         ensure_dir(self.log_dir)
         log_file_path = os.path.join(self.log_dir, self.logfile_name)
         from logging.handlers import RotatingFileHandler
-        logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 
1024 * 1024, backupCount=5)
+        logfile_handler = RotatingFileHandler(log_file_path, maxBytes=10 * 
1024 * 1024, backupCount=5,
+                                              encoding=LOG_FILE_ENCODING)
         lfmt = logging.Formatter('%(process)d : %(asctime)s : %(levelname)s : 
%(name)s : %(message)s')
         logfile_handler.setFormatter(lfmt)
         logfile_handler.setLevel(logging.DEBUG)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/knack/parser.py 
new/knack-0.8.2/knack/parser.py
--- old/knack-0.8.0/knack/parser.py     2021-03-26 07:10:52.000000000 +0100
+++ new/knack-0.8.2/knack/parser.py     2021-05-08 08:50:44.000000000 +0200
@@ -266,19 +266,24 @@
         import sys
 
         if action.choices is not None and value not in action.choices:
-            # parser has no `command_source`, value is part of command itself
-            error_msg = "{prog}: '{value}' is not in the '{prog}' command 
group. See '{prog} --help'.".format(
-                prog=self.prog, value=value)
-            logger.error(error_msg)
-            candidates = difflib.get_close_matches(value, action.choices, 
cutoff=0.7)
-            if candidates:
-                print_args = {
-                    's': 's' if len(candidates) > 1 else '',
-                    'verb': 'are' if len(candidates) > 1 else 'is',
-                    'value': value
-                }
-                suggestion_msg = "\nThe most similar choice{s} to '{value}' 
{verb}:\n".format(**print_args)
-                suggestion_msg += '\n'.join(['\t' + candidate for candidate in 
candidates])
+            if action.dest in ["_command", "_subcommand"]:
+                # Command
+                error_msg = "{prog}: '{value}' is not in the '{prog}' command 
group. See '{prog} --help'.".format(
+                    prog=self.prog, value=value)
+                logger.error(error_msg)
+                # Show suggestions
+                candidates = difflib.get_close_matches(value, action.choices, 
cutoff=0.7)
+                if candidates:
+                    suggestion_msg = "\nThe most similar choices to 
'{value}':\n".format(value=value)
+                    suggestion_msg += '\n'.join(['\t' + candidate for 
candidate in candidates])
+                    print(suggestion_msg, file=sys.stderr)
+            else:
+                # Argument
+                error_msg = "{prog}: '{value}' is not a valid value for 
'{name}'.".format(
+                    prog=self.prog, value=value,
+                    name=argparse._get_action_name(action))  # pylint: 
disable=protected-access
+                logger.error(error_msg)
+                # Show all allowed values
+                suggestion_msg = "Allowed values: " + ', '.join(action.choices)
                 print(suggestion_msg, file=sys.stderr)
-
             self.exit(2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/knack.egg-info/PKG-INFO 
new/knack-0.8.2/knack.egg-info/PKG-INFO
--- old/knack-0.8.0/knack.egg-info/PKG-INFO     2021-03-26 07:10:57.000000000 
+0100
+++ new/knack-0.8.2/knack.egg-info/PKG-INFO     2021-05-08 08:50:47.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: knack
-Version: 0.8.0
+Version: 0.8.2
 Summary: A Command-Line Interface framework
 Home-page: https://github.com/microsoft/knack
 Author: Microsoft Corporation
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/setup.py new/knack-0.8.2/setup.py
--- old/knack-0.8.0/setup.py    2021-03-26 07:10:52.000000000 +0100
+++ new/knack-0.8.2/setup.py    2021-05-08 08:50:44.000000000 +0200
@@ -8,7 +8,7 @@
 from codecs import open
 from setuptools import setup, find_packages
 
-VERSION = '0.8.0'
+VERSION = '0.8.2'
 
 DEPENDENCIES = [
     'argcomplete',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/knack-0.8.0/tests/test_parser.py 
new/knack-0.8.2/tests/test_parser.py
--- old/knack-0.8.0/tests/test_parser.py        2021-03-26 07:10:52.000000000 
+0100
+++ new/knack-0.8.2/tests/test_parser.py        2021-05-08 08:50:44.000000000 
+0200
@@ -9,7 +9,7 @@
 from knack.parser import CLICommandParser
 from knack.commands import CLICommand
 from knack.arguments import enum_choice_list
-from tests.util import MockContext
+from tests.util import MockContext, redirect_io
 
 
 class TestParser(unittest.TestCase):
@@ -83,7 +83,7 @@
         parser.parse_args('test command -req yep'.split())
         self.assertTrue(CLICommandParser.error.called)
 
-    def test_case_insensitive_enum_choices(self):
+    def _enum_parser(self):
         from enum import Enum
 
         class TestEnum(Enum):  # pylint: disable=too-few-public-methods
@@ -102,7 +102,10 @@
 
         parser = CLICommandParser()
         parser.load_command_table(self.mock_ctx.commands_loader)
+        return parser
 
+    def test_case_insensitive_enum_choices(self):
+        parser = self._enum_parser()
         args = parser.parse_args('test command --opt alL_cAps'.split())
         self.assertEqual(args.opt, 'ALL_CAPS')
 
@@ -112,6 +115,22 @@
         args = parser.parse_args('test command --opt sNake_CASE'.split())
         self.assertEqual(args.opt, 'snake_case')
 
+    @redirect_io
+    def test_check_value_invalid_command(self):
+        parser = self._enum_parser()
+        with self.assertRaises(SystemExit) as cm:
+            parser.parse_args('test command1'.split())  # 'command1' is invalid
+        actual = self.io.getvalue()
+        assert "is not in the" in actual and "command group" in actual
+
+    @redirect_io
+    def test_check_value_invalid_argument_value(self):
+        parser = self._enum_parser()
+        with self.assertRaises(SystemExit) as cm:
+            parser.parse_args('test command --opt foo'.split())  # 'foo' is 
invalid
+        actual = self.io.getvalue()
+        assert "is not a valid value for" in actual
+
     def test_cli_ctx_type_error(self):
         with self.assertRaises(TypeError):
             CLICommandParser(cli_ctx=object())

Reply via email to