Python 2+3 version variable and test macros#63
Open
kyrios123 wants to merge 1 commit intosolus-project:masterfrom
kyrios123:python-test
Open
Python 2+3 version variable and test macros#63kyrios123 wants to merge 1 commit intosolus-project:masterfrom kyrios123:python-test
kyrios123 wants to merge 1 commit intosolus-project:masterfrom
kyrios123:python-test
Conversation
**Variable Macros** (used in the below macros) - `%python2_version%` returns **2.7** for Python 2.7.x - `%python2_version%` returns **3.6** for Python 3.6.x **Actionable Macros** (python unit tests) `%python_test` and `%python3_test` If the `PYTHONPATH` environment variable is not set, the macro will do it The following cases are handled: 1. The macro is called without parameters -> use default test function e.g.: `%python_test` -> `python setup.py test` 2. The macro is called with a python script (`.py`) as parameter -> execute the script with the specified version of python e.g.: `%python3_test selftest.py -v` -> `python3 selftest.py -v` 3. The macro is called with something else as parameter -> execute the command "as it is" e.g.: `%python_test py.test -k 'not this_test'` -> `py.test -k 'not this_test'` The macros will look for the "standard" build directories `py2build` or `py3build` and be executed in the current directory if they can't find it, so they can also be used in packages build with autotools for example. Signed-off-by: Pierre-Yves <pyu@riseup.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Variable Macros (used in the below macros)
%python2_version%returns 2.7 for Python 2.7.x%python2_version%returns 3.6 for Python 3.6.xActionable Macros (python unit tests)
%python_testand%python3_testIf the
PYTHONPATHenvironment variable is not set, the macro will do itThe following cases are handled:
The macro is called without parameters -> use default test function
e.g.:
%python_test->python setup.py testThe macro is called with a python script (
.py) as parameter -> execute the script with the specified version of pythone.g.:
%python3_test selftest.py -v->python3 selftest.py -vThe macro is called with something else as parameter -> execute the command "as it is"
e.g.:
%python_test py.test -k 'not this_test'->py.test -k 'not this_test'The macros will look for the "standard" build directories
py2buildorpy3buildand be executed in the current directory if they can't find it, so they can also be used in packages build with autotools for example.Signed-off-by: Pierre-Yves pyu@riseup.net