def test_python_via_env(self, templar): assert amc._get_shebang(u'/usr/bin/python', {u'assible_python_interpreter': u'/usr/bin/env python'}, templar) == \ (u'#!/usr/bin/env python', u'/usr/bin/env python')
def test_with_args(self, templar): assert amc._get_shebang(u'/usr/bin/python', {u'assible_python_interpreter': u'/usr/bin/python3'}, templar, args=('-tt', '-OO')) == \ (u'#!/usr/bin/python3 -tt -OO', u'/usr/bin/python3')
def test_non_python_interpreter_in_task_vars(self, templar): assert amc._get_shebang(u'/usr/bin/ruby', {u'assible_ruby_interpreter': u'/usr/local/bin/ruby'}, templar) == \ (u'#!/usr/local/bin/ruby', u'/usr/local/bin/ruby')
def test_interpreter_set_in_task_vars(self, templar): assert amc._get_shebang(u'/usr/bin/python', {u'assible_python_interpreter': u'/usr/bin/pypy'}, templar) == \ (u'#!/usr/bin/pypy', u'/usr/bin/pypy')
def test_non_python_interpreter(self, templar): assert amc._get_shebang(u'/usr/bin/ruby', {}, templar) == (None, u'/usr/bin/ruby')
def test_no_interpreter_set(self, templar): # normally this would return /usr/bin/python, but so long as we're defaulting to auto python discovery, we'll get # an InterpreterDiscoveryRequiredError here instead with pytest.raises(InterpreterDiscoveryRequiredError): amc._get_shebang(u'/usr/bin/python', {}, templar)