Mercurial > hg-stable
view tests/test-status-inprocess.py @ 23933:769027075e21 stable
run-tests.py: execute hghave with same env vars as ones for actual tests
Before this patch, "run-tests.py" executes "hghave" process without
any modifications for environment variables, even though actual tests
are executed with LC_ALL, LANG and LANGUAGE explicitly assigned "C".
When "run-tests.py" is executed:
- with non-"C" locale environment variables on any platforms, or
- without any explicit locale environment setting on Windows
(only for "outer-repo" feature using "hg root")
external commands indirectly executed by "hghave" may show translated
messages.
This causes incorrect "hghave" result and skipping tests, because some
regexp matching of "hghave" expect external commands to show
un-translated messages.
To prevent external commands from showing translated messages, this
patch makes "run-tests.py" execute "hghave" with same environment
variables as ones for actual tests.
This patch doesn't make "hghave" execute external commands forcibly
with LC_ALL, LANG and LANGUAGE explicitly assigned "C", because
changing "run-tests.py" is cheaper than changing "hghave":
- "os.popen" should be replaced by "subprocess.Popen" or so, and
- setting up environment variables should be newly added
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 22 Jan 2015 00:03:58 +0900 |
parents | 13a1b2fb7ef2 |
children | 7779f9dfd938 |
line wrap: on
line source
#!/usr/bin/python from mercurial.ui import ui from mercurial.localrepo import localrepository from mercurial.commands import add, commit, status u = ui() print '% creating repo' repo = localrepository(u, '.', create=True) f = open('test.py', 'w') try: f.write('foo\n') finally: f.close print '% add and commit' add(u, repo, 'test.py') commit(u, repo, message='*') status(u, repo, clean=True) print '% change' f = open('test.py', 'w') try: f.write('bar\n') finally: f.close() # this would return clean instead of changed before the fix status(u, repo, clean=True, modified=True)