Skip to content

Commit e139e53

Browse files
committed
Additional test
1 parent d2d1b2e commit e139e53

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

tests/test_install_command.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ def __init__(self, tmp_path, *args, **kwargs):
244244
self.repair = kwargs.pop("repair", False)
245245
self.shebang_can_run_anything = kwargs.pop("shebang_can_run_anything", False)
246246
self.shebang_can_run_anything_silently = kwargs.pop("shebang_can_run_anything_silently", False)
247+
self.shebang_templates = {}
247248
self.source = kwargs.pop("source", "http://example.com/index.json")
248249
self.target = kwargs.pop("target", None)
249250
if self.target:

tests/test_scriptutils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,10 @@ def test_quote_args(args, expect):
279279

280280
@pytest.mark.parametrize("line, expect_id, expect_line", [pytest.param(*a, id=a[0]) for a in [
281281
("#!/usr/bin/python", "Test1", None),
282-
("#!/usr/bin/python2", "Test2", None),
282+
("#! /usr/bin/python2", "Test2", None),
283+
("#! custom", None, "#!CUSTOM"),
284+
("#! custom full line", None, "#!CUSTOM2"),
285+
("#!custom full line with extra", None, None),
283286
# TODO: More test cases
284287
]])
285288
def test_shebang_templates(fake_config, line, expect_id, expect_line):
@@ -290,6 +293,8 @@ def test_shebang_templates(fake_config, line, expect_id, expect_line):
290293
fake_config.shebang_templates = {
291294
"/usr/bin/python": "py",
292295
"/usr/bin/python2": "py -V:Test/2",
296+
"custom": "CUSTOM",
297+
"custom full line": "CUSTOM2",
293298
}
294299
actual, actual_line = _replace_templates(fake_config, line, False)
295300
if expect_id:
@@ -298,4 +303,5 @@ def test_shebang_templates(fake_config, line, expect_id, expect_line):
298303
elif expect_line:
299304
assert expect_line == actual_line
300305
else:
301-
pytest.fail("Invalid test")
306+
assert not actual
307+
assert not actual_line

0 commit comments

Comments
 (0)