Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fe10811

Browse files
authored
Merge pull request #1236 from pre-commit/future_proof_parse_shebang_test
Use echo instead of python in parse_shebang_test
2 parents cb36410 + 9fada61 commit fe10811

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

tests/parse_shebang_test.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def test_file_doesnt_exist():
2121

2222
def test_simple_case(tmpdir):
2323
x = tmpdir.join('f')
24-
x.write_text('#!/usr/bin/env python', encoding='UTF-8')
24+
x.write_text('#!/usr/bin/env echo', encoding='UTF-8')
2525
make_executable(x.strpath)
26-
assert parse_shebang.parse_filename(x.strpath) == ('python',)
26+
assert parse_shebang.parse_filename(x.strpath) == ('echo',)
2727

2828

2929
def test_find_executable_full_path():
@@ -125,28 +125,28 @@ def test_normalize_cmd_trivial():
125125

126126

127127
def test_normalize_cmd_PATH():
128-
cmd = ('python', '--version')
129-
expected = (distutils.spawn.find_executable('python'), '--version')
128+
cmd = ('echo', '--version')
129+
expected = (distutils.spawn.find_executable('echo'), '--version')
130130
assert parse_shebang.normalize_cmd(cmd) == expected
131131

132132

133133
def test_normalize_cmd_shebang(in_tmpdir):
134-
python = distutils.spawn.find_executable('python').replace(os.sep, '/')
135-
path = write_executable(python)
136-
assert parse_shebang.normalize_cmd((path,)) == (python, path)
134+
echo = distutils.spawn.find_executable('echo').replace(os.sep, '/')
135+
path = write_executable(echo)
136+
assert parse_shebang.normalize_cmd((path,)) == (echo, path)
137137

138138

139139
def test_normalize_cmd_PATH_shebang_full_path(in_tmpdir):
140-
python = distutils.spawn.find_executable('python').replace(os.sep, '/')
141-
path = write_executable(python)
140+
echo = distutils.spawn.find_executable('echo').replace(os.sep, '/')
141+
path = write_executable(echo)
142142
with bin_on_path():
143143
ret = parse_shebang.normalize_cmd(('run',))
144-
assert ret == (python, os.path.abspath(path))
144+
assert ret == (echo, os.path.abspath(path))
145145

146146

147147
def test_normalize_cmd_PATH_shebang_PATH(in_tmpdir):
148-
python = distutils.spawn.find_executable('python')
149-
path = write_executable('/usr/bin/env python')
148+
echo = distutils.spawn.find_executable('echo')
149+
path = write_executable('/usr/bin/env echo')
150150
with bin_on_path():
151151
ret = parse_shebang.normalize_cmd(('run',))
152-
assert ret == (python, os.path.abspath(path))
152+
assert ret == (echo, os.path.abspath(path))

0 commit comments

Comments
 (0)