tests: ensure we're run via tox

Otherwise, setup functions that set git config variables like
user.name are potentially dangerous to run.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-02-08 15:34:26 -08:00 committed by Marti Bolivar
parent 8ef8a1c117
commit d57aa43d6e
5 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,8 @@ from west import configuration as config
from conftest import cmd
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
SYSTEM = config.ConfigFile.SYSTEM
GLOBAL = config.ConfigFile.GLOBAL
LOCAL = config.ConfigFile.LOCAL

View File

@ -8,6 +8,8 @@ import sys
from west.app.main import BUILTIN_COMMAND_GROUPS
from conftest import cmd
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
def test_builtin_help_and_dash_h(west_init_tmpdir):
# Test "west help" and "west -h" are the same for built-in
# functionality.

View File

@ -1,8 +1,11 @@
import os
import subprocess
import sys
import west.version
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
def test_main():
# A quick check that the package can be executed as a module which
# takes arguments, using e.g. "python3 -m west --version" to

View File

@ -28,6 +28,8 @@ from west.manifest import Manifest, Project, ManifestProject, \
from conftest import create_workspace, create_repo, checkout_branch, \
create_branch, add_commit, rev_parse, GIT, check_proj_consistency
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
FPI = ImportFlag.FORCE_PROJECTS # to force project imports to use the callback
if platform.system() == 'Windows':

View File

@ -18,6 +18,8 @@ from west.manifest import ImportFlag as MIF
from conftest import create_workspace, create_repo, add_commit, add_tag, \
check_output, cmd, GIT, rev_parse, check_proj_consistency
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
#
# Helpers
#