k3shell 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3shell
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Shell command dispatcher with nested subcommand support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
6
  License: MIT
@@ -24,6 +24,7 @@ Provides-Extra: dev
24
24
  Requires-Dist: pytest>=7.0; extra == "dev"
25
25
  Requires-Dist: ruff; extra == "dev"
26
26
  Requires-Dist: coverage; extra == "dev"
27
+ Requires-Dist: k3ut; extra == "dev"
27
28
  Provides-Extra: publish
28
29
  Requires-Dist: build; extra == "publish"
29
30
  Requires-Dist: twine; extra == "publish"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: k3shell
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Shell command dispatcher with nested subcommand support
5
5
  Author-email: Zhang Yanpo <drdr.xp@gmail.com>
6
6
  License: MIT
@@ -24,6 +24,7 @@ Provides-Extra: dev
24
24
  Requires-Dist: pytest>=7.0; extra == "dev"
25
25
  Requires-Dist: ruff; extra == "dev"
26
26
  Requires-Dist: coverage; extra == "dev"
27
+ Requires-Dist: k3ut; extra == "dev"
27
28
  Provides-Extra: publish
28
29
  Requires-Dist: build; extra == "publish"
29
30
  Requires-Dist: twine; extra == "publish"
@@ -4,6 +4,7 @@ k3dict
4
4
  pytest>=7.0
5
5
  ruff
6
6
  coverage
7
+ k3ut
7
8
 
8
9
  [docs]
9
10
  mkdocs>=1.5
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "k3shell"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "Shell command dispatcher with nested subcommand support"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -37,6 +37,7 @@ dev = [
37
37
  "pytest>=7.0",
38
38
  "ruff",
39
39
  "coverage",
40
+ "k3ut",
40
41
  ]
41
42
  publish = [
42
43
  "build",
@@ -7,6 +7,9 @@ import logging
7
7
  import sys
8
8
  import k3shell
9
9
 
10
+ # Python 3.10+ changed argparse help text from "optional arguments:" to "options:"
11
+ OPTARGS = "options:\n" if sys.version_info >= (3, 10) else "optional arguments:\n"
12
+
10
13
 
11
14
  class TestCommand(unittest.TestCase):
12
15
  def setUp(self):
@@ -74,11 +77,14 @@ class TestCommand(unittest.TestCase):
74
77
  self.execute_test(arguments, argv, out_str, exit_code)
75
78
 
76
79
  def test_command_execute_error(self):
80
+ # Note: Lambda names in error messages include qualified path in Python 3.10+
81
+ # e.g., "TestCommand.test_command_execute_error.<locals>.<lambda>()"
82
+ # So we only check for the error type prefix
77
83
  testcases = (
78
84
  (
79
85
  {"divi": lambda x, y: int(x) / int(y)},
80
86
  ["divi"],
81
- "TypeError(\"<lambda>() missing 2 required positional arguments: 'x' and 'y'\"",
87
+ 'TypeError("',
82
88
  1,
83
89
  ),
84
90
  (
@@ -88,7 +94,7 @@ class TestCommand(unittest.TestCase):
88
94
  },
89
95
  },
90
96
  ["mod", "mod_2"],
91
- "TypeError(\"<lambda>() missing 1 required positional argument: 'x'\"",
97
+ 'TypeError("',
92
98
  1,
93
99
  ),
94
100
  (
@@ -182,7 +188,7 @@ class TestCommand(unittest.TestCase):
182
188
  + ' foo bar print a "bar".\n'
183
189
  + " foo bob plus do addition operation with 2 numbers.\n"
184
190
  + "\n"
185
- + "optional arguments:\n"
191
+ + OPTARGS
186
192
  + " -h, --help show this help message and exit\n",
187
193
  0,
188
194
  "use -h to get help message",
@@ -194,17 +200,14 @@ class TestCommand(unittest.TestCase):
194
200
  + "positional arguments:\n"
195
201
  + " x just an input message\n"
196
202
  + "\n"
197
- + "optional arguments:\n"
203
+ + OPTARGS
198
204
  + " -h, --help show this help message and exit\n",
199
205
  0,
200
206
  "use valid command and -h to get parameter help message",
201
207
  ),
202
208
  (
203
209
  ["foo", "bar", "-h"],
204
- "usage: python foo bar [-h]\n"
205
- + "\n"
206
- + "optional arguments:\n"
207
- + " -h, --help show this help message and exit\n",
210
+ "usage: python foo bar [-h]\n" + "\n" + OPTARGS + " -h, --help show this help message and exit\n",
208
211
  0,
209
212
  "use valid command and -h to get parameter help message when no parameter setted.",
210
213
  ),
@@ -216,7 +219,7 @@ class TestCommand(unittest.TestCase):
216
219
  + " x an int is needed\n"
217
220
  + " y an int is needed\n"
218
221
  + "\n"
219
- + "optional arguments:\n"
222
+ + OPTARGS
220
223
  + " -h, --help show this help message and exit\n",
221
224
  0,
222
225
  "use valid command and -h to get parameter help message when many parameters setted.",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes