From 2eb41fe707d5fc22d3576ae5d1b1a6928ad56c67 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Thu, 23 Jul 2020 13:33:22 +0200 Subject: [PATCH] Implement an environment variable to run tests with specific macros --- tests/test_evals.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test_evals.py b/tests/test_evals.py index ec26668..5c8db71 100644 --- a/tests/test_evals.py +++ b/tests/test_evals.py @@ -8,9 +8,24 @@ import pytest 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="" 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]