from holoviews import NdMapping, Layout from holoviews.interface.collector import Collector from holoviews.core.element import Collator from lancet import PrettyPrinted, vcs_metadata from lancet import Command from lancet import Launcher, review_and_launch from lancet import ViewFile from lancet import Log, FileInfo, FileType from lancet import List, Args import topo try: from external import sys_paths submodule_paths = sys_paths() ordering = ['topographica', 'param', 'paramtk', 'imagen', 'lancet'] summarized = ['topographica', 'param', 'imagen', 'lancet'] submodules = [[p for p in submodule_paths if p.endswith(name)][0] for name in ordering] except: submodules = [] from topo.misc.commandline import default_output_path review_and_launch.output_directory = default_output_path() Launcher.output_directory = default_output_path() class topo_metadata(param.Parameterized): """ Topographica specific helper function that expands on Lancet's vcs_metadata function to generate suitable metadata information for
from holoviews import NdMapping, Layout from holoviews.interface.collector import Collector from holoviews.core.element import Collator from holoviews.core.io import Pickler from lancet import PrettyPrinted, vcs_metadata from lancet import Command from lancet import Launcher, review_and_launch from lancet import Log, FileInfo, FileType from lancet import List, Args import topo try: from external import sys_paths submodule_paths = sys_paths() ordering = ['topographica', 'param', 'paramtk', 'imagen', 'lancet'] summarized = ['topographica', 'param', 'imagen', 'lancet'] submodules = [[p for p in submodule_paths if p.endswith(name)][0] for name in ordering] except: submodules = [] from topo.misc.commandline import default_output_path review_and_launch.output_directory = default_output_path() Launcher.output_directory = default_output_path() class topo_metadata(param.Parameterized): """ Topographica specific helper function that expands on Lancet's
def t_action(option,opt_str,value,parser): """Callback function for the -t option for invoking tests.""" local_target_descriptions = {"unit":"Quick unit tests using nosetests and doctest.", "all":"All correctness tests (i.e. all tests but speed, coverage).", "coverage":"Same as unit but measuring test coverage.", "exhaustive":"Slow system tests.", "speed":"Test for changes in execution speed.", "quick":"All tests whose runtimes are in seconds.", "flakes":"Run pyflakes static code checker."} local_targets = [] env = os.environ.copy() pypath = env.get('PYTHONPATH','') env['PYTHONPATH'] = pypath + ':'.join(p for p in sys_paths()) # Targets handled in this file if value in ["list","unit","flakes","coverage"]: local_targets += [value] value = None # Other targets require runtests.py if value == "quick": local_targets += ["unit","flakes"] if value == "all": local_targets += ["unit","flakes"] value = "exhaustive" import subprocess global return_code # JABALERT: Unlike the tests in runtests.py, will not use xvfb-run # to hide GUI windows being tested. Once runtests.py is made into # a module, the code it contains for conditionally using xvfb-run # can be applied here as well. if "flakes" in local_targets: targets = ["topo", "external/param", "external/paramtk", "external/imagen", "external/lancet"] ret = subprocess.call(["python","topo/tests/buildbot/pyflakes-ignore.py","--ignore", "topo/tests","--total"] + targets) return_code += abs(ret) if "unit" in local_targets: proc = subprocess.Popen(["nosetests", "-v", "--with-doctest", "--doctest-extension=txt"], env=env) proc.wait() return_code += abs(proc.returncode) if "coverage" in local_targets: proc = subprocess.Popen(["nosetests", "-v", "--with-doctest", "--doctest-extension=txt", "--with-cov", "--cov-report", "html"], env=env) proc.wait() return_code += abs(proc.returncode) from topo.tests.runtests import target_description if value is not None: if value not in ["quick","exhaustive"] and value not in target_description: print "\nCould not find test target %r.\n" % value local_targets =['list'] else: global_params.exec_in_context("targets=['%s']" % value) # Call runtests.run_tests() as if it were a proper module ns={} execfile('./topo/tests/runtests.py',ns,ns) return_code += len(ns["run_tests"]()) if "list" in local_targets: available_items = sorted((target_description.items() + local_target_descriptions.items())) max_len = max(len(k) for k,_ in available_items) print ("---------------\nAvailable tests\n---------------\n%s" % "\n".join('%s%s : %s'% (k,' '*(max_len-len(k)),v) for k,v in available_items)) global something_executed something_executed=True
def t_action(option, opt_str, value, parser): """Callback function for the -t option for invoking tests.""" local_target_descriptions = { "unit": "Quick unit tests using nosetests and doctest.", "all": "All correctness tests (i.e. all tests but speed, coverage).", "coverage": "Same as unit but measuring test coverage.", "exhaustive": "Slow system tests.", "speed": "Test for changes in execution speed.", "quick": "All tests whose runtimes are in seconds.", "flakes": "Run pyflakes static code checker." } local_targets = [] env = os.environ.copy() pypath = env.get('PYTHONPATH', '') env['PYTHONPATH'] = pypath + ':'.join(p for p in sys_paths()) # Targets handled in this file if value in ["list", "unit", "flakes", "coverage"]: local_targets += [value] value = None # Other targets require runtests.py if value == "quick": local_targets += ["unit", "flakes"] if value == "all": local_targets += ["unit", "flakes"] value = "exhaustive" import subprocess global return_code # JABALERT: Unlike the tests in runtests.py, will not use xvfb-run # to hide GUI windows being tested. Once runtests.py is made into # a module, the code it contains for conditionally using xvfb-run # can be applied here as well. if "flakes" in local_targets: targets = [ "topo", "external/param", "external/paramtk", "external/holoviews", "external/imagen", "external/lancet" ] ret = subprocess.call([ "python", "topo/tests/buildbot/pyflakes-ignore.py", "--ignore", "topo/tests", "--total" ] + targets) return_code += abs(ret) if "unit" in local_targets: proc = subprocess.Popen( ["nosetests", "-v", "--with-doctest", "--doctest-extension=txt"], env=env) proc.wait() return_code += abs(proc.returncode) if "coverage" in local_targets: proc = subprocess.Popen([ "nosetests", "-v", "--with-doctest", "--doctest-extension=txt", "--with-cov", "--cov-report", "html" ], env=env) proc.wait() return_code += abs(proc.returncode) from topo.tests.runtests import target_description if value is not None: if value not in ["quick", "exhaustive" ] and value not in target_description: print "\nCould not find test target %r.\n" % value local_targets = ['list'] else: global_params.exec_in_context("targets=['%s']" % value) # Call runtests.run_tests() as if it were a proper module ns = {} execfile('./topo/tests/runtests.py', ns, ns) return_code += len(ns["run_tests"]()) if "list" in local_targets: available_items = sorted( (target_description.items() + local_target_descriptions.items())) max_len = max(len(k) for k, _ in available_items) print( "---------------\nAvailable tests\n---------------\n%s" % "\n".join('%s%s : %s' % (k, ' ' * (max_len - len(k)), v) for k, v in available_items)) global something_executed something_executed = True
import os, sys, types, pickle, inspect from collections import namedtuple import numpy.version as np_version import topo import param from lancet import PrettyPrinted, vcs_metadata from lancet import Command from lancet import Launcher, review_and_launch from lancet import NumpyFile try: from external import sys_paths submodules = sys_paths() except: submodules = [] from topo.misc.commandline import default_output_path review_and_launch.output_directory = default_output_path() Launcher.output_directory = default_output_path() class topo_metadata(param.Parameterized): """ Topographica specific helper function that expands on Lancet's vcs_metadata function to generate suitable metadata information for logging with Lancet. Records Topographica version control information as well as information about all relevant submodules and the current numpy version.