From a5aa0e399b5d790c7cdc37e21b7c7f4d84e68b4f Mon Sep 17 00:00:00 2001 From: Piotr Orzechowski Date: Tue, 13 Dec 2022 19:53:36 +0100 Subject: [PATCH] Use `alr` from project bin dir in testsuite (#1262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Mention Python 3 testsuite run script's comment * Prepend alr project dir to PATH before running tests * Fail user input validation test explicitly Use Polish letter 'ł' to make user input validation test explicitly mention encoding problems when failing. --- testsuite/run.py | 12 +++++++++++- testsuite/tests/init/user-input-validation/test.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/testsuite/run.py b/testsuite/run.py index 68bab1a61..41263a1dc 100755 --- a/testsuite/run.py +++ b/testsuite/run.py @@ -3,7 +3,7 @@ """ e3.testsuite-based testsuite for Alire/ALR. -Just execute this script to run the testsuite. It requires a Python2 +Just execute this script to run the testsuite. It requires a Python 3 interpreter with the e3-core and e3-testsuite packages (from PyPI) installed. """ @@ -30,6 +30,16 @@ def set_up(self): # Some tests rely on an initially empty GPR_PROJECT_PATH variable os.environ.pop('GPR_PROJECT_PATH', None) + # Let's run `alr` from project's dir + alr_path = self._get_alr_path() + self._prepend_alr_to_path_env_var(alr_path) + + def _get_alr_path(self): + project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + return os.path.join(project_root, 'bin') + + def _prepend_alr_to_path_env_var(self, alr_path): + os.environ['PATH'] = alr_path + os.pathsep + os.environ['PATH'] if __name__ == '__main__': suite = Testsuite() diff --git a/testsuite/tests/init/user-input-validation/test.py b/testsuite/tests/init/user-input-validation/test.py index f4c0c4e45..07cbbd233 100644 --- a/testsuite/tests/init/user-input-validation/test.py +++ b/testsuite/tests/init/user-input-validation/test.py @@ -9,7 +9,7 @@ from drivers.helpers import content_of # Preconfigure needed fields -name = "Äl O'Reilly O\"Raro" +name = "Äł O'Reilly O\"Raro" run_alr("config", "--global", "--set", "user.email", "abc@de.com") run_alr("config", "--global", "--set", "user.github_login", "abcde") run_alr("config", "--global", "--set", "user.name", name)