Skip to content

Commit bdcbdc2

Browse files
committed
Fix test error "fatal: empty ident name (for <(null)>) not allowed"
Occurs when tests run with tox not with Travis CI or Appveyor Changed existing tox setenv statement to use whitespace around `=` as per http://tox.readthedocs.io/en/latest/example/basic.html#setting-environment-variables
1 parent 8cd6245 commit bdcbdc2

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ env: # These should match the tox env list
88
- TOXENV=py27 LATEST_GIT=1
99
install: pip install coveralls tox
1010
script: tox
11-
# Special snowflake. Our tests depend on making real commits.
1211
before_install:
13-
- git config --global user.name "Travis CI"
14-
- git config --global user.email "user@example.com"
1512
# Our tests inspect some of *our* git history
1613
- git fetch --unshallow
1714
- git --version

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ install:
1313
build: false
1414

1515
before_test:
16-
- git config --global user.name "AppVeyor CI"
17-
- git config --global user.email "user@example.com"
1816
# Shut up CRLF messages
1917
- git config --global core.safecrlf false
2018

tests/commands/install_uninstall_test.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,17 @@ def test_environment_not_sourced(tempdir_factory):
223223

224224
# Use a specific homedir to ignore --user installs
225225
homedir = tempdir_factory.get()
226-
# Need this so we can call git commit without sploding
227-
with io.open(os.path.join(homedir, '.gitconfig'), 'w') as gitconfig:
228-
gitconfig.write(
229-
'[user]\n'
230-
' name = Travis CI\n'
231-
' email = user@example.com\n'
232-
)
233226
ret, stdout, stderr = cmd_output(
234227
'git', 'commit', '--allow-empty', '-m', 'foo',
235-
env={'HOME': homedir, 'PATH': _path_without_us()},
228+
env={
229+
'HOME': homedir,
230+
'PATH': _path_without_us(),
231+
# Git needs this to make a commit
232+
'GIT_AUTHOR_NAME': os.environ['GIT_AUTHOR_NAME'],
233+
'GIT_COMMITTER_NAME': os.environ['GIT_COMMITTER_NAME'],
234+
'GIT_AUTHOR_EMAIL': os.environ['GIT_AUTHOR_EMAIL'],
235+
'GIT_COMMITTER_EMAIL': os.environ['GIT_COMMITTER_EMAIL'],
236+
},
236237
retcode=None,
237238
)
238239
assert ret == 1
@@ -474,6 +475,11 @@ def test_installed_from_venv(tempdir_factory):
474475
'SYSTEMROOT': os.environ.get('SYSTEMROOT', ''),
475476
# Windows needs this to resolve executables
476477
'PATHEXT': os.environ.get('PATHEXT', ''),
478+
# Git needs this to make a commit
479+
'GIT_AUTHOR_NAME': os.environ['GIT_AUTHOR_NAME'],
480+
'GIT_COMMITTER_NAME': os.environ['GIT_COMMITTER_NAME'],
481+
'GIT_AUTHOR_EMAIL': os.environ['GIT_AUTHOR_EMAIL'],
482+
'GIT_COMMITTER_EMAIL': os.environ['GIT_COMMITTER_EMAIL'],
477483
},
478484
)
479485
assert ret == 0

tox.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ envlist = py27,py34,py35,pypy
66
[testenv]
77
deps = -rrequirements-dev.txt
88
passenv = HOME HOMEPATH PROGRAMDATA TERM
9-
setenv = VIRTUALENV_NO_DOWNLOAD=1
9+
setenv =
10+
VIRTUALENV_NO_DOWNLOAD = 1
11+
GIT_AUTHOR_NAME = "test"
12+
GIT_COMMITTER_NAME = "test"
13+
GIT_AUTHOR_EMAIL = "test@example.com"
14+
GIT_COMMITTER_EMAIL = "test@example.com"
1015
commands =
1116
coverage erase
1217
coverage run -m pytest {posargs:tests}

0 commit comments

Comments
 (0)