Skip to content

Commit f5693b8

Browse files
authored
bump version, merge pull request #21 from iterative/devel
2 parents 67be753 + 0cd9501 commit f5693b8

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python }}
2727
- run: pip install -U -r requirements-dev.txt
28-
- run: python -m tests
28+
- run: python -m tests --cov-report=term-missing
2929
- uses: codecov/codecov-action@v1
3030
deploy:
3131
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

shtab/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ def replace_format(string, **fmt):
153153

154154

155155
def wordify(string):
156-
"""Replace hyphens (-) and spaces ( ) with underscores (_)"""
157-
return string.replace("-", "_").replace(" ", "_")
156+
"""Replace non-word chars [-. ] with underscores [_]"""
157+
return string.replace("-", "_").replace(".", " ").replace(" ", "_")
158158

159159

160160
def get_bash_commands(root_parser, root_prefix, choice_functions=None):

tests/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
66
check_call(
77
(
8-
"py.test -v --log-level=debug --cov=shtab --cov-report=xml"
9-
" {params} --durations=0".format(params=" ".join(sys.argv[1:]))
8+
"py.test -v --log-level=debug --cov=shtab"
9+
" --cov-report=xml --cov-report=term-missing --durations=0"
10+
+ (" ".join([""] + sys.argv[1:]))
1011
),
1112
shell=True,
1213
env=dict(os.environ, PYTHONPATH=REPO_ROOT),

tests/test_shtab.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,31 @@ def test_prog_override(shell, caplog, capsys):
9191
assert not caplog.record_tuples
9292

9393

94+
@fix_shell
95+
def test_prog_scripts(shell, caplog, capsys):
96+
with caplog.at_level(logging.INFO):
97+
main(
98+
["-s", shell, "--prog", "script.py", "shtab.main.get_main_parser"]
99+
)
100+
101+
captured = capsys.readouterr()
102+
assert not captured.err
103+
script_py = [
104+
i.strip() for i in captured.out.splitlines() if "script.py" in i
105+
]
106+
if shell == "bash":
107+
assert script_py == ["complete -o nospace -F _shtab_shtab script.py"]
108+
elif shell == "zsh":
109+
assert script_py == [
110+
"#compdef script.py",
111+
"_describe 'script.py commands' _commands",
112+
]
113+
else:
114+
raise NotImplementedError(shell)
115+
116+
assert not caplog.record_tuples
117+
118+
94119
@fix_shell
95120
def test_prefix_override(shell, caplog, capsys):
96121
with caplog.at_level(logging.INFO):

0 commit comments

Comments
 (0)