Пример #1
0
def pytest_configure(config):
    """ Load Test Suite Configuration. """
    dirname = os.getcwd()
    config_path = config.getoption('suite_config')
    config_path = 'config.toml' if not config_path else config_path
    config_path = os.path.join(dirname, config_path)
    print(
        '\nAttempting to load configuration from file: %s\n' %
        config_path
    )

    try:
        config.suite_config = load_config(config_path)
    except FileNotFoundError:
        config.suite_config = default()
    config.suite_config['save_path'] = config.getoption('save_path')

    # Override default terminal reporter for better test output when not capturing
    if config.getoption('capture') == 'no':
        reporter = config.pluginmanager.get_plugin('terminalreporter')
        agent_reporter = AgentTerminalReporter(config, sys.stdout)
        config.pluginmanager.unregister(reporter)
        config.pluginmanager.register(agent_reporter, 'terminalreporter')

    # Compile select regex and test regex if given
    select_regex = config.getoption('select')
    config.select_regex = re.compile(select_regex) if select_regex else None
    config.tests_regex = list(map(
        re.compile, config.suite_config['tests']
    ))
Пример #2
0
 def __init__(self):
     cmdln.Cmdln.__init__(self)
     
     if not os.path.exists(app.CONFIG_FILEPATH):
         self.config_dict = config.default()
     else:
         self.config_dict = config.read(app.CONFIG_FILEPATH)
Пример #3
0
def pytest_configure(config):
    """ Load Test Suite Configuration. """
    dirname = os.getcwd()
    config_path = config.getoption('suite_config')
    config_path = 'config.toml' if not config_path else config_path
    config_path = os.path.join(dirname, config_path)
    print('\nLoading Agent Test Suite configuration from file: %s\n' %
          config_path)

    try:
        config.suite_config = load_config(config_path)
    except FileNotFoundError:
        config.suite_config = default()
    config.suite_config['save_path'] = config.getoption('save_path')

    # register additional markers
    config.addinivalue_line(
        "markers", "features(name[, name, ...]):"
        "Define what features the test belongs to.")
    config.addinivalue_line(
        "markers", "priority(int): Define test priority for "
        "ordering tests. Higher numbers occur first.")

    # Override default terminal reporter for better test output
    reporter = config.pluginmanager.get_plugin('terminalreporter')
    agent_reporter = AgentTerminalReporter(config, sys.stdout)
    config.pluginmanager.unregister(reporter)
    config.pluginmanager.register(agent_reporter, 'terminalreporter')

    # Compile SELECT_REGEX if given
    select_regex = config.getoption('select')
    config.select_regex = re.compile(select_regex) if select_regex else None
    config.features = config.suite_config['features']
Пример #4
0
import config

config.default('pbs_host', 'zen.millennium.berkeley.edu')
config.default('pbs_user', 'jda')
config.default('pbs_work_dir', '/work/jda')

config.default('pbs', True)
Пример #5
0
      img = img.Scale(40, 40, wx.IMAGE_QUALITY_HIGH).ConvertToBitmap()
      self.toolbar.SetToolNormalBitmap(id=self.RUN_ID, bitmap=img)



class AntSimApp(wx.App):

  def OnInit(self):
    w, h = configuration['world_size']
    zoom = configuration['zoom']
    self.frame = AntSimFrame(size=(w * zoom, h * zoom))
    self.frame.Show()
    self.SetTopWindow(self.frame)
    return True



if __name__ == '__main__':
  # check if a program configuration file is provided
  if len(sys.argv) > 1:
    configuration = config.deserialize(sys.argv[1])
  elif os.path.isfile('config.json'):
    configuration = config.deserialize('config.json')
  else:
    # use default configuration
    _, configuration = config.default()
  #filename, configuration = config.default()
  #config.serialize(filename, configuration)
  app = AntSimApp()
  app.MainLoop()
Пример #6
0
import config
import fridge
import logging
import os
import sys
import traceback

logger = logging.getLogger(__name__)

config.default('root', os.getcwd())
config.default('experiments_dir_name', 'work')
config.default('experiments_dir',
               os.path.join(config.root, config.experiments_dir_name))
config.default('work_dir', config.timestamp_dir(config.experiments_dir))
config.default('latest_link_file_name', 'latest')
config.default('latest_link_file', os.path.join(config.root, 'latest'))
config.default('failure_file_name', 'FAIL.txt')
config.default('failure_file',
               os.path.join(config.work_dir, config.failure_file_name))
config.default('config_file_name', 'config.txt')
config.default('config_file',
               os.path.join(config.work_dir, config.config_file_name))
config.default('log_file_name', 'run.log')
config.default('log_file', os.path.join(config.work_dir, config.log_file_name))
config.default('data_dir_name', 'data')
config.default('data_dir', os.path.join(config.root, config.data_dir_name))

config.default('pbs_ssh_promiscuous', True)

DEV = 'dev'
TEST = 'test'
Пример #7
0
            self.paused = True
            fn = os.path.join(os.path.dirname(__file__), '../img/play.png')
            img = wx.Image(fn, wx.BITMAP_TYPE_ANY)
            img = img.Scale(40, 40, wx.IMAGE_QUALITY_HIGH).ConvertToBitmap()
            self.toolbar.SetToolNormalBitmap(id=self.RUN_ID, bitmap=img)


class AntSimApp(wx.App):
    def OnInit(self):
        w, h = configuration['world_size']
        zoom = configuration['zoom']
        self.frame = AntSimFrame(size=(w * zoom, h * zoom))
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True


if __name__ == '__main__':
    # check if a program configuration file is provided
    if len(sys.argv) > 1:
        configuration = config.deserialize(sys.argv[1])
    elif os.path.isfile('config.json'):
        configuration = config.deserialize('config.json')
    else:
        # use default configuration
        _, configuration = config.default()
    #filename, configuration = config.default()
    #config.serialize(filename, configuration)
    app = AntSimApp()
    app.MainLoop()
Пример #8
0
import config
import fridge
import logging
import os
import sys
import traceback

logger = logging.getLogger(__name__)

config.default('root', os.getcwd())
config.default('experiments_dir_name', 'work')
config.default('experiments_dir', os.path.join(config.root, config.experiments_dir_name))
config.default('work_dir', config.timestamp_dir(config.experiments_dir))
config.default('latest_link_file_name', 'latest')
config.default('latest_link_file', os.path.join(config.root, 'latest'))
config.default('failure_file_name', 'FAIL.txt')
config.default('failure_file', os.path.join(config.work_dir, config.failure_file_name))
config.default('config_file_name', 'config.txt')
config.default('config_file', os.path.join(config.work_dir, config.config_file_name))
config.default('log_file_name', 'run.log')
config.default('log_file', os.path.join(config.work_dir, config.log_file_name))
config.default('data_dir_name', 'data')
config.default('data_dir', os.path.join(config.root, config.data_dir_name))

config.default('pbs_ssh_promiscuous', True)

DEV = 'dev'
TEST = 'test'

class Experiment(object):