From d21638424cc92d8fa00e7f440300c92d8532f5a8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 15 Feb 2020 13:44:56 -0500 Subject: [PATCH] tox: get tests passing a bit on Windows We need to use the path separators provided by the python library, and we need to set the git env vars so the name is always known. Not all tests pass, but at least the basic frameworks work now. Change-Id: Icea67098a8d7d58bbf918c78325681cf12a2e5f2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255313 Reviewed-by: David Pursehouse Tested-by: Mike Frysinger --- run_tests | 8 +++++--- tox.ini | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/run_tests b/run_tests index d7144b3c..a09ab382 100755 --- a/run_tests +++ b/run_tests @@ -42,9 +42,11 @@ def main(argv): """The main entry.""" # Add the repo tree to PYTHONPATH as the tests expect to be able to import # modules directly. - topdir = os.path.dirname(os.path.realpath(__file__)) - pythonpath = os.environ.get('PYTHONPATH', '') - os.environ['PYTHONPATH'] = '%s:%s' % (topdir, pythonpath) + pythonpath = os.path.dirname(os.path.realpath(__file__)) + oldpythonpath = os.environ.get('PYTHONPATH', None) + if oldpythonpath is not None: + pythonpath += os.pathsep + oldpythonpath + os.environ['PYTHONPATH'] = pythonpath return run_pytest('pytest', argv) diff --git a/tox.ini b/tox.ini index bd1e18cc..1a9642a3 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,11 @@ envlist = py27, py36, py37, py38 [testenv] deps = pytest -commands = {toxinidir}/run_tests +commands = {envpython} run_tests +setenv = + GIT_AUTHOR_NAME = Repo test author + GIT_COMMITTER_NAME = Repo test committer + EMAIL = repo@gerrit.nodomain [testenv:py27] deps =