Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
specify environment explicitly for doctests
Browse files Browse the repository at this point in the history
the git interface seems to ignore changes made to os.environ
  • Loading branch information
ohanar committed Nov 15, 2013
1 parent e977e69 commit 2e77868
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/sage/dev/git_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import os

from sage.env import (
SAGE_DOT_GIT, SAGE_REPO_AUTHENTICATED, SAGE_ROOT,
SAGE_DOT_GIT, SAGE_REPO_AUTHENTICATED, SAGE_ROOT,
SAGE_REPO_ANONYMOUS
)

Expand Down Expand Up @@ -105,10 +105,10 @@ def _run_git(self, cmd, args, git_kwds, popen_kwds=dict()):
sage: os.chdir(config['git']['src'])
sage: git._run_git('status', (), {})
(0,
(0,
'# On branch master\n#\n# Initial commit\n#\nnothing to commit
(create/copy files and use "git add" to track)\n',
'',
(create/copy files and use "git add" to track)\n',
'',
'git -c user.email=doc@test.test -c user.name=doctest status')
TESTS:
Expand Down Expand Up @@ -964,22 +964,22 @@ def local_branches(self):
Create some branches::
sage: os.chdir(config['git']['src'])
sage: os.environ['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:10")
sage: git.silent.commit('-m','initial commit','--allow-empty')
sage: env = {'GIT_COMMITTER_DATE': time.strftime("%Y-%m-%dT%H:%M:10")}
sage: git.silent.commit('-m','initial commit','--allow-empty', env=env)
sage: git.super_silent.checkout('-b', 'branch')
sage: os.environ['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:20")
sage: git.silent.commit('-m','second commit','--allow-empty')
sage: env['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:20")
sage: git.silent.commit('-m','second commit','--allow-empty', env=env)
sage: git.super_silent.checkout('-b', 'other', 'master')
sage: os.environ['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:30")
sage: git.silent.commit('-m','third commit','--allow-empty')
sage: env['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:30")
sage: git.silent.commit('-m','third commit','--allow-empty', env=env)
Use this repository as a remote repository::
sage: config2 = DoctestConfig()
sage: git2 = GitInterface(config2["git"], DoctestUserInterface(config["UI"]))
sage: os.chdir(config2['git']['src'])
sage: os.environ['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:40")
sage: git2.silent.commit('-m','initial commit','--allow-empty')
sage: env['GIT_COMMITTER_DATE'] = time.strftime("%Y-%m-%dT%H:%M:40")
sage: git2.silent.commit('-m','initial commit','--allow-empty', env=env)
sage: git2.silent.remote('add', 'git', config['git']['src'])
sage: git2.super_silent.fetch('git')
sage: git2.super_silent.checkout("branch")
Expand Down

0 comments on commit 2e77868

Please sign in to comment.