| |
@@ -42,6 +42,13 @@
|
| |
return cp.stdout.strip().splitlines()
|
| |
|
| |
|
| |
+ def shell_stdout(script):
|
| |
+ return subprocess.check_output(script,
|
| |
+ env={**os.environ, 'LANG': 'C.utf-8'},
|
| |
+ text=True,
|
| |
+ shell=True).rstrip()
|
| |
+
|
| |
+
|
| |
@pytest.mark.parametrize('argument, result', [
|
| |
('a', 'a'),
|
| |
('a-a', 'a-a'),
|
| |
@@ -252,22 +259,31 @@
|
| |
|
| |
def test_py3_shebang_fix():
|
| |
cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3')[-1].strip()
|
| |
- assert cmd == '$pathfix -pni /usr/bin/python3 -ka s arg1 arg2 arg3'
|
| |
+ assert cmd == '$pathfix -pni /usr/bin/python3 $shebang_flags arg1 arg2 arg3'
|
| |
+
|
| |
+
|
| |
+ def test_py3_shebang_fix_default_shebang_flags():
|
| |
+ lines = rpm_eval('%py3_shebang_fix arg1 arg2')
|
| |
+ lines[-1] = 'echo $shebang_flags'
|
| |
+ assert shell_stdout('\n'.join(lines)) == '-kas'
|
| |
|
| |
|
| |
- def test_py3_shebang_fix_custom_flags():
|
| |
- cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3', py3_shebang_flags='Es')[-1].strip()
|
| |
- assert cmd == '$pathfix -pni /usr/bin/python3 -ka Es arg1 arg2 arg3'
|
| |
+ def test_py3_shebang_fix_custom_shebang_flags():
|
| |
+ lines = rpm_eval('%py3_shebang_fix arg1 arg2', py3_shebang_flags='Es')
|
| |
+ lines[-1] = 'echo $shebang_flags'
|
| |
+ assert shell_stdout('\n'.join(lines)) == '-kaEs'
|
| |
|
| |
|
| |
- def test_py3_shebang_fix_empty_flags():
|
| |
- cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3', py3_shebang_flags=None)[-1].strip()
|
| |
- assert cmd == '$pathfix -pni /usr/bin/python3 -k arg1 arg2 arg3'
|
| |
+ @pytest.mark.parametrize('flags', [None, '%{nil}'])
|
| |
+ def test_py3_shebang_fix_no_shebang_flags(flags):
|
| |
+ lines = rpm_eval('%py3_shebang_fix arg1 arg2', py3_shebang_flags=flags)
|
| |
+ lines[-1] = 'echo $shebang_flags'
|
| |
+ assert shell_stdout('\n'.join(lines)) == '-k'
|
| |
|
| |
|
| |
- def test_py_shebang_fix_custom():
|
| |
+ def test_py_shebang_fix_custom_python():
|
| |
cmd = rpm_eval('%py_shebang_fix arg1 arg2 arg3', __python='/usr/bin/pypy')[-1].strip()
|
| |
- assert cmd == '$pathfix -pni /usr/bin/pypy -ka s arg1 arg2 arg3'
|
| |
+ assert cmd == '$pathfix -pni /usr/bin/pypy $shebang_flags arg1 arg2 arg3'
|
| |
|
| |
|
| |
def test_pycached_in_sitelib():
|
| |