| |
@@ -8,9 +8,24 @@
|
| |
X_Y = f'{sys.version_info[0]}.{sys.version_info[1]}'
|
| |
XY = f'{sys.version_info[0]}{sys.version_info[1]}'
|
| |
|
| |
+ # Handy environment variable you can use to run the tests
|
| |
+ # with modified macros files. Multiple files should be
|
| |
+ # separated by colon.
|
| |
+ # To get 'em all, run:
|
| |
+ # ls -1 macros.* | tr "\n" ":"
|
| |
+ # and then:
|
| |
+ # TESTED_FILES="<output of previous command>" pytest -v
|
| |
+ # or both combined:
|
| |
+ # TESTED_FILES=$(ls -1 macros.* | tr "\n" ":") pytest -v
|
| |
+ # Remember that some tests might need more macros files than just
|
| |
+ # the local ones.
|
| |
+ TESTED_FILES = os.getenv("TESTED_FILES", None)
|
| |
+
|
| |
|
| |
def rpm_eval(expression, fails=False, **kwargs):
|
| |
cmd = ['rpmbuild']
|
| |
+ if TESTED_FILES:
|
| |
+ cmd += ['--macros', TESTED_FILES]
|
| |
for var, value in kwargs.items():
|
| |
if value is None:
|
| |
cmd += ['--undefine', var]
|
| |
@@ -228,23 +243,23 @@
|
| |
|
| |
|
| |
def test_py3_shebang_fix():
|
| |
- cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3')[0]
|
| |
- assert cmd == '/usr/bin/pathfix.py -pni /usr/bin/python3 -ka s arg1 arg2 arg3'
|
| |
+ cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3')[-1].strip()
|
| |
+ assert cmd == '$pathfix -pni /usr/bin/python3 -ka s arg1 arg2 arg3'
|
| |
|
| |
|
| |
def test_py3_shebang_fix_custom_flags():
|
| |
- cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3', py3_shebang_flags='Es')[0]
|
| |
- assert cmd == '/usr/bin/pathfix.py -pni /usr/bin/python3 -ka Es arg1 arg2 arg3'
|
| |
+ 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_empty_flags():
|
| |
- cmd = rpm_eval('%py3_shebang_fix arg1 arg2 arg3', py3_shebang_flags=None)[0]
|
| |
- assert cmd == '/usr/bin/pathfix.py -pni /usr/bin/python3 -k arg1 arg2 arg3'
|
| |
+ 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'
|
| |
|
| |
|
| |
def test_py_shebang_fix_custom():
|
| |
- cmd = rpm_eval('%py_shebang_fix arg1 arg2 arg3', __python='/usr/bin/pypy')[0]
|
| |
- assert cmd == '/usr/bin/pathfix.py -pni /usr/bin/pypy -ka s arg1 arg2 arg3'
|
| |
+ 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'
|
| |
|
| |
|
| |
def test_pycached_in_sitelib():
|
| |
Depends on: https://src.fedoraproject.org/rpms/python3.9/pull-request/19
The tests should work on all supported releases with the main python3-devel packages because the oldest one is Fedora 31 with Python 3.7.7 where we backport the mentioned change.