Skip to content

Commit

Permalink
Move os.environ['LANG'] = 'C' into just those unit tests which call e…
Browse files Browse the repository at this point in the history
…xternal tools. Having it in run_tests.py was changing the default encoding causing problems on Python 3 with special characters in plain text files
  • Loading branch information
peterjc committed Jul 26, 2010
1 parent 0543e25 commit 3ab8a0f
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ def main(argv):
if os.access(build_path, os.F_OK):
sys.path.insert(1, build_path)

# Use "export LANG=C" (which should work on Linux and similar) to
# try to avoid problems detecting optional command line tools on
# non-English OS (we may want 'command not found' in English)
os.environ['LANG']='C'
# Using "export LANG=C" (which should work on Linux and similar) can
# avoid problems detecting optional command line tools on
# non-English OS (we may want 'command not found' in English).
# HOWEVER, we do not want to change the default encoding which is
# rather important on Python 3 with unicode.
#lang = os.environ['LANG']

# get the command line options
try:
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Clustalw_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

#################################################################

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

clustalw_exe = None
if sys.platform=="win32":
#TODO - Check the path?
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Dialign_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from Bio import MissingExternalDependencyError
from Bio.Align.Applications import DialignCommandline

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

dialign_exe = None
if sys.platform=="win32":
raise MissingExternalDependencyError("DIALIGN2-2 not available on Windows")
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Emboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#################################################################

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

exes_wanted = ["water", "needle", "seqret", "transeq", "seqmatchall",
"embossversion"]
exes = dict() #Dictionary mapping from names to exe locations
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_EmbossPhylipNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from Bio.Emboss.Applications import FProtParsCommandline, FConsenseCommandline
from Bio.Emboss.Applications import FTreeDistCommandline, FDNAParsCommandline

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

exes_wanted = ['fdnadist', 'fneighbor', 'fprotdist','fprotpars','fconsense',
'fseqboot', 'ftreedist', 'fdnapars']
exes = dict() #Dictionary mapping from names to exe locations
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Mafft_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from Bio import MissingExternalDependencyError
from Bio.Align.Applications import MafftCommandline

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

mafft_exe = None
if sys.platform=="win32":
raise MissingExternalDependencyError("Testing with MAFFT not implemented on Windows yet")
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Muscle_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

#################################################################

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

muscle_exe = None
if sys.platform=="win32":
try:
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Prank_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from Bio.Align.Applications import PrankCommandline
from Bio.Nexus.Nexus import NexusError

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

prank_exe = None
if sys.platform=="win32":
try:
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_Probcons_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from Bio import AlignIO, SeqIO, MissingExternalDependencyError
from Bio.Align.Applications import ProbconsCommandline

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

probcons_exe = None
if sys.platform=="win32":
raise MissingExternalDependencyError("PROBCONS not available on Windows")
Expand Down
3 changes: 3 additions & 0 deletions Tests/test_TCoffee_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
from Bio import AlignIO, SeqIO, MissingExternalDependencyError
from Bio.Align.Applications import TCoffeeCommandline

#Try to avoid problems when the OS is in another language
os.environ['LANG'] = 'C'

t_coffee_exe = None
if sys.platform=="win32":
raise MissingExternalDependencyError(\
Expand Down

0 comments on commit 3ab8a0f

Please sign in to comment.