[yt-svn] commit/yt: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Dec 21 08:31:10 PST 2011


3 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/5836ac1385c4/
changeset:   5836ac1385c4
branch:      yt
user:        MatthewTurk
date:        2011-12-21 17:29:22
summary:     Removing references to cmdln module.
affected #:  1 file

diff -r e1ba861e4f74d3151e6f35b9aade388e51143f28 -r 5836ac1385c477c880ca855c64c3fd7c77127526 yt/utilities/answer_testing/runner.py
--- a/yt/utilities/answer_testing/runner.py
+++ b/yt/utilities/answer_testing/runner.py
@@ -27,8 +27,8 @@
 import os, shelve, cPickle, sys, imp, tempfile
 
 from yt.config import ytcfg; ytcfg["yt","serialize"] = "False"
-import yt.utilities.cmdln as cmdln
 from yt.funcs import *
+from yt.utilities.command_line import YTCommand
 from .xunit import Xunit
 
 from output_tests import test_registry, MultipleOutputTest, \
@@ -169,98 +169,22 @@
             print "Running '%s'" % (test_name)
             self.run_test(line.strip())
 
-class EnzoTestRunnerCommands(cmdln.Cmdln):
-    name = "enzo_tests"
+def _load_modules(test_modules):
+    for fn in test_modules:
+        if fn.endswith(".py"): fn = fn[:-3]
+        print "Loading module %s" % (fn)
+        mname = os.path.basename(fn)
+        f, filename, desc = imp.find_module(mname, [os.path.dirname(fn)])
+        project = imp.load_module(mname, f, filename, desc)
 
-    def _load_modules(self, test_modules):
-        for fn in test_modules:
-            if fn.endswith(".py"): fn = fn[:-3]
-            print "Loading module %s" % (fn)
-            mname = os.path.basename(fn)
-            f, filename, desc = imp.find_module(mname, [os.path.dirname(fn)])
-            project = imp.load_module(mname, f, filename, desc)
-
-    def _update_io_log(self, opts, kwargs):
-        if opts.datasets is None or len(opts.datasets) == 0: return
-        f = tempfile.NamedTemporaryFile()
-        kwargs['io_log'] = f.name
-        for d in opts.datasets:
-            fn = os.path.expanduser(d)
-            print "Registered dataset %s" % fn
-            f.write("DATASET WRITTEN %s\n" % fn)
-        f.flush()
-        f.seek(0)
-        return f
-
-    @cmdln.option("-f", "--dataset", action="append",
-                  help="override the io_log and add this to the new one",
-                  dest="datasets")
-    @cmdln.option("-p", "--results-path", action="store",
-                  help="which directory should results be stored in",
-                  dest="results_path", default=".")
-    def do_store(self, subcmd, opts, name, *test_modules):
-        """
-        ${cmd_name}: Run and store a new dataset.
-
-        ${cmd_usage}
-        ${cmd_option_list}
-        """
-        sys.path.insert(0, ".")
-        self._load_modules(test_modules)
-        kwargs = {}
-        f = self._update_io_log(opts, kwargs)
-        test_runner = RegressionTestRunner(name,
-                results_path = opts.results_path,
-                **kwargs)
-        test_runner.run_all_tests()
-
-    @cmdln.option("-o", "--output", action="store",
-                  help="output results to file",
-                  dest="outputfile", default=None)
-    @cmdln.option("-p", "--results-path", action="store",
-                  help="which directory should results be stored in",
-                  dest="results_path", default=".")
-    @cmdln.option("-n", "--nose", action="store_true",
-                  help="run through nose with xUnit testing",
-                  dest="run_nose", default=False)
-    @cmdln.option("-f", "--dataset", action="append",
-                  help="override the io_log and add this to the new one",
-                  dest="datasets")
-    def do_compare(self, subcmd, opts, reference, comparison, *test_modules):
-        """
-        ${cmd_name}: Compare a reference dataset against a new dataset.  The
-        new dataset will be run regardless of whether it exists or not.
-
-        ${cmd_usage}
-        ${cmd_option_list}
-        """
-        if comparison == "__CURRENT__":
-            import pkg_resources
-            yt_provider = pkg_resources.get_provider("yt")
-            path = os.path.dirname(yt_provider.module_path)
-            from yt.funcs import get_hg_version
-            comparison = get_hg_version(path)[:12]
-            print "Setting comparison to: %s" % (comparison)
-        sys.path.insert(0, ".")
-        self._load_modules(test_modules)
-        kwargs = {}
-        f = self._update_io_log(opts, kwargs)
-        test_runner = RegressionTestRunner(comparison, reference,
-                            results_path=opts.results_path,
-                            **kwargs)
-        if opts.run_nose:
-            test_runner.watcher = Xunit()
-        results = test_runner.run_all_tests()
-        if opts.run_nose:
-            test_runner.watcher.report()
-        if opts.outputfile is not None:
-            f = open(str(opts.outputfile), "w")
-            for testname, success in sorted(results.items()):
-                f.write("%s %s\n" % (testname.ljust(100), success))
-
-def run_main():
-    etrc = EnzoTestRunnerCommands()
-    sys.exit(etrc.main())
-
-if __name__ == "__main__":
-    run_main()
+def _update_io_log(opts, kwargs):
+    if opts.datasets is None or len(opts.datasets) == 0: return
+    f = tempfile.NamedTemporaryFile()
+    kwargs['io_log'] = f.name
+    for d in opts.datasets:
+        fn = os.path.expanduser(d)
+        print "Registered dataset %s" % fn
+        f.write("DATASET WRITTEN %s\n" % fn)
+    f.flush()
+    f.seek(0)
+    return f



https://bitbucket.org/yt_analysis/yt/changeset/9b3963e8b6eb/
changeset:   9b3963e8b6eb
branch:      yt
user:        MatthewTurk
date:        2011-12-21 17:30:10
summary:     Removing "run_main"
affected #:  1 file

diff -r 5836ac1385c477c880ca855c64c3fd7c77127526 -r 9b3963e8b6eb13e1f2f7264ee389e01f4617f41f yt/utilities/answer_testing/api.py
--- a/yt/utilities/answer_testing/api.py
+++ b/yt/utilities/answer_testing/api.py
@@ -31,7 +31,6 @@
 from .runner import \
     RegressionTestRunner, \
     RegressionTestStorage, \
-    run_main, \
     clear_registry, \
     registry_entries
 



https://bitbucket.org/yt_analysis/yt/changeset/45f2231f2491/
changeset:   45f2231f2491
branch:      yt
user:        MatthewTurk
date:        2011-12-21 17:30:45
summary:     Removing run_main from one more place.
affected #:  1 file

diff -r 9b3963e8b6eb13e1f2f7264ee389e01f4617f41f -r 45f2231f24919f866a256688204694f2800d9fd3 yt/utilities/answer_testing/__init__.py
--- a/yt/utilities/answer_testing/__init__.py
+++ b/yt/utilities/answer_testing/__init__.py
@@ -24,7 +24,7 @@
 """
 
 import runner, output_tests
-from runner import RegressionTestRunner, run_main
+from runner import RegressionTestRunner
 
 from output_tests import RegressionTest, SingleOutputTest, \
     MultipleOutputTest, YTStaticOutputTest, create_test

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list