Skip to content

Commit

Permalink
Fix tests for Git submodule (#3737)
Browse files Browse the repository at this point in the history
I can't explain why this isn't happening for everyone, however the issue I git
was that my global git config wasn't being picked up. This explicitly sets the
user name and email to avoid erroring out on the following calls.
  • Loading branch information
agjohnson committed Mar 6, 2018
1 parent 230ec2b commit e25acfa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion readthedocs/rtd_tests/utils.py
@@ -1,15 +1,18 @@
"""Utility functions for use in tests."""

from __future__ import absolute_import

import logging
import subprocess
from os import chdir, environ, getcwd
from os.path import abspath, join as pjoin
from shutil import copytree
import subprocess
from tempfile import mkdtemp

from django_dynamic_fixture import new
from django.contrib.auth.models import User


log = logging.getLogger(__name__)


Expand All @@ -31,7 +34,19 @@ def make_test_git():
env = environ.copy()
env['GIT_DIR'] = pjoin(directory, '.git')
chdir(directory)

# Initialize and configure
log.info(check_output(['git', 'init'] + [directory], env=env))
log.info(check_output(
['git', 'config', 'user.email', 'dev@readthedocs.org'],
env=env
))
log.info(check_output(
['git', 'config', 'user.name', 'Read the Docs'],
env=env
))

# Set up the actual repository
log.info(check_output(['git', 'add', '.'], env=env))
log.info(check_output(['git', 'commit', '-m"init"'], env=env))
# Add repo itself as submodule
Expand Down

0 comments on commit e25acfa

Please sign in to comment.