Skip to content

Commit

Permalink
Use alr from project bin dir in testsuite (#1262)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
0rzech authored Dec 13, 2022
1 parent 5db2881 commit a5aa0e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion testsuite/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/init/user-input-validation/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a5aa0e3

Please sign in to comment.