Skip to content

Commit

Permalink
The modification to setup.py gives the option of --no-gui for the com…
Browse files Browse the repository at this point in the history
…mand

"test", which is passed to Tests/run_tests.py as an argument. The modification
to run_tests.py includes changing argv from being sys.argv by default to
sys.argv[1:] by default, which is more conventional, and also easier to
substitute for cases such as this where run_test.main() is called externally.
  • Loading branch information
lasher committed Apr 11, 2007
1 parent b3bbfdb commit 1d16b65
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Tests/run_tests.py
Expand Up @@ -56,7 +56,7 @@ def main(argv):


# get the command line options # get the command line options
try: try:
opts, args = getopt.getopt(argv[1:], 'g', opts, args = getopt.getopt(argv, 'g',
["generate", "no-gui", "help"]) ["generate", "no-gui", "help"])
except getopt.error, msg: except getopt.error, msg:
print msg print msg
Expand Down Expand Up @@ -316,5 +316,5 @@ def convert_string_newlines(line):
return line return line


if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main(sys.argv)) sys.exit(main(sys.argv[1:]))


20 changes: 15 additions & 5 deletions setup.py
Expand Up @@ -238,19 +238,29 @@ class test_biopython(Command):
""" """
description = "Automatically run the test suite for Biopython." description = "Automatically run the test suite for Biopython."
user_options = [] # distutils complains if this is not here.
def initialize_options(self): # distutils wants this user_options = [
pass # provide the option to run tests in no-gui mode
def finalize_options(self): # this too ('no-gui', None, "Do not run in GUI mode")
]

def initialize_options(self):
self.no_gui = None

def finalize_options(self):
pass pass

def run(self): def run(self):
this_dir = os.getcwd() this_dir = os.getcwd()


# change to the test dir and run the tests # change to the test dir and run the tests
os.chdir("Tests") os.chdir("Tests")
sys.path.insert(0, '') sys.path.insert(0, '')
import run_tests import run_tests
run_tests.main([]) if self.no_gui:
run_tests.main(['--no-gui'])
else:
run_tests.main([])


# change back to the current directory # change back to the current directory
os.chdir(this_dir) os.chdir(this_dir)
Expand Down

0 comments on commit 1d16b65

Please sign in to comment.