From 1d16b653b164cd120dfcdd462f298c31f2ecce8a Mon Sep 17 00:00:00 2001 From: lasher Date: Wed, 11 Apr 2007 04:53:33 +0000 Subject: [PATCH] The modification to setup.py gives the option of --no-gui for the command "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. --- Tests/run_tests.py | 4 ++-- setup.py | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Tests/run_tests.py b/Tests/run_tests.py index 492a8a643d1..45bb02910e9 100644 --- a/Tests/run_tests.py +++ b/Tests/run_tests.py @@ -56,7 +56,7 @@ def main(argv): # get the command line options try: - opts, args = getopt.getopt(argv[1:], 'g', + opts, args = getopt.getopt(argv, 'g', ["generate", "no-gui", "help"]) except getopt.error, msg: print msg @@ -316,5 +316,5 @@ def convert_string_newlines(line): return line if __name__ == "__main__": - sys.exit(main(sys.argv)) + sys.exit(main(sys.argv[1:])) diff --git a/setup.py b/setup.py index a8367e56699..bf16be0f3ca 100644 --- a/setup.py +++ b/setup.py @@ -238,11 +238,18 @@ class test_biopython(Command): """ description = "Automatically run the test suite for Biopython." - user_options = [] # distutils complains if this is not here. - def initialize_options(self): # distutils wants this - pass - def finalize_options(self): # this too + + user_options = [ + # provide the option to run tests in no-gui mode + ('no-gui', None, "Do not run in GUI mode") + ] + + def initialize_options(self): + self.no_gui = None + + def finalize_options(self): pass + def run(self): this_dir = os.getcwd() @@ -250,7 +257,10 @@ def run(self): os.chdir("Tests") sys.path.insert(0, '') 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 os.chdir(this_dir)