コード例 #1
0
 def _create_data(self, resource_name, resource_import):
     res_path = os.path.abspath(resource_name)
     tcf = TestCaseFile(source=os.path.abspath('test.txt'))
     tcf.setting_table.add_resource(resource_import)
     tcf.variable_table.add('${dirname}', os.path.abspath('.').replace('\\', '\\\\'))
     tcf.variable_table.add('${path}', os.path.abspath(resource_name).replace('\\', '\\\\'))
     library_manager = LibraryManager(':memory:')
     library_manager.create_database()
     self.project = Project(Namespace(FakeSettings()), FakeSettings(), library_manager)
     self.project._controller = TestCaseFileController(tcf, self.project)
     res = ResourceFile(source=res_path)
     self.res_controller = \
         self.project._resource_file_controller_factory.create(res)
     self.project._namespace._resource_factory.cache[os.path.normcase(res_path)] = res
コード例 #2
0
 def setUp(self):
     settings = FakeSettings()
     self.app = wx.App()
     self.frame = wx.Frame(None)
     self.frame.tree = Tree(
         self.frame,
         ActionRegisterer(AuiManager(self.frame), MenuBar(self.frame),
                          ToolBar(self.frame),
                          ShortcutRegistry(self.frame)), settings)
     self.frame.Show()
     self._tags_list = utils.NormalizedDict()
     self._tags_list = {
         "tag-11": [1, 2],
         "tag-02": [3],
         "tag-12": [4, 8, 12],
         "tag-2": [5, 6, 7],
         "tag-3": [9],
         "tag-21": [10, 11, 12],
         "tag-22": [10],
         "tag-1": [14],
         "tag-03": [15],
         "a-01-a2": [1],
         "08-b": [2],
         "3-2-1-tag-2c": [3, 6, 8],
         "8-B-1": [3, 4, 5],
         "2-b": [7, 3],
         "a-1-a3": [8, 9, 10, 11],
         "3-2-03-tag-2a": [12],
         "a-01-a03": [1],
         "b-1-a01": [2],
         "b-01-a01": [15]
     }
     self.model = self._create_model()
     self._tagsdialog = _ViewAllTagsDialog(self.frame, self.model)
コード例 #3
0
 def _load(self, testcasefile):
     ns = Namespace(FakeSettings())
     library_manager = LibraryManager(':memory:')
     library_manager.create_database()
     project = Project(ns, settings=ns._settings, library_manager=library_manager)
     project.load_datafile(testcasefile,
                         MessageRecordingLoadObserver())
     return ns, project._controller.data, library_manager
コード例 #4
0
ファイル: test_tagdialogs.py プロジェクト: jnhyperion/RIDE
 def _create_model(self):
     suite = self._create_directory_suite('/top_suite')
     suite.children = [self._create_file_suite('sub_suite_%d.txt' % i)
                       for i in range(3)]
     res = ResourceFile()
     res.source = 'resource.txt'
     res.keyword_table.keywords.append(UserKeyword(res, 'Resource Keyword'))
     library_manager = LibraryManager(':memory:')
     library_manager.create_database()
     model = Project(
         Namespace(FakeSettings()), library_manager=library_manager)
     model._controller = TestDataDirectoryController(suite)
     rfc = ResourceFileController(res, project=model)
     model.resources.append(rfc)
     model.insert_into_suite_structure(rfc)
     return model
コード例 #5
0
def TestCaseControllerWithSteps(project=None, source='some_suite.txt'):
    tcf = TestCaseFile()
    tcf.source = source
    tcf.setting_table.suite_setup.name = 'Suite Setup Kw'
    tcf.setting_table.test_setup.name = SUITE_TEST_SETUP_KEYWORD
    tcf.setting_table.test_teardown.name = 'Test Teardown Kw'
    tcf.setting_table.suite_teardown.name = 'Suite Teardown Kw'
    tcf.setting_table.test_template.value = SUITE_TEST_TEMPLATE_KEYWORD
    testcase = _create_testcase(tcf)
    uk = tcf.keyword_table.add(USERKEYWORD1_NAME)
    uk.add_step([KEYWORD_IN_USERKEYWORD1])
    uk = tcf.keyword_table.add(USERKEYWORD2_NAME)
    uk.add_step(['No Operation'])
    uk = tcf.keyword_table.add(EMBEDDED_ARGUMENTS_KEYWORD)
    uk.add_step(['No Operation'])
    if project is None:
        library_manager = LibraryManager(':memory:')
        library_manager.create_database()
        project = Project(Namespace(FakeSettings()),
                          library_manager=library_manager)
    tcf_ctrl = TestCaseFileController(tcf, project)
    project._controller = tcf_ctrl
    tctablectrl = TestCaseTableController(tcf_ctrl, tcf.testcase_table)
    return TestCaseController(tctablectrl, testcase), project._namespace
コード例 #6
0
 def test_resourcefactory_finds_imported_resource_from_python_path(self):
     self.r = _ResourceFactory(FakeSettings())
     self.r.from_path = os.path.dirname(__file__)
     self._is_resolved(self.r)
コード例 #7
0
 def test_resourcefactory_finds_imported_resource(self):
     self.r = _ResourceFactory(FakeSettings())
     self._is_resolved(self.r)
コード例 #8
0
 def _create_factory(self, excluded_dir):
     settings = FakeSettings()
     settings.set('default directory', os.path.dirname(__file__))
     settings.excludes.update_excludes([excluded_dir])
     # print("DEBUG Test Resource Factory create factory: %s\n" % list(settings))
     return _ResourceFactory(settings)
コード例 #9
0
 def setUp(self):
     ns = Namespace(FakeSettings())
     self.project = ProjectChecker(ns, settings=ns._settings)
コード例 #10
0
 def setUp(self):
     self._library_manager = _library_manager()
     self.ctrl = Project(Namespace(FakeSettings()), FakeSettings(), self._library_manager)
     self.load_observer = MessageRecordingLoadObserver()
     self.suite_listener = PublisherListener(RideOpenSuite)
     self.resource_listener = PublisherListener(RideOpenResource)
コード例 #11
0
 def setUp(self):
     self.project = Project(Namespace(FakeSettings()), FakeSettings(), _library_manager())
コード例 #12
0
class _Log(object):
    def __init__(self):
        self.log = ''

    def error(self, msg):
        self.log += msg


LOGGER = _Log()
robotide.context.LOG = LOGGER

from robotide.application.pluginloader import PluginLoader
from robotide.log import LogPlugin
from utest.resources import FakeApplication, FakeSettings

robotide.application.pluginconnector.SETTINGS = FakeSettings()


class TestPluginLoader(unittest.TestCase):
    used_plugin_class = LogPlugin
    expected_plugins = [
        'Example Plugin 1', 'Example Plugin 2', 'Example Plugin 3',
        utils.name_from_class(used_plugin_class, drop='Plugin')
    ]

    def setUp(self):
        plugins_dir = [
            os.path.join(os.path.dirname(__file__), 'plugins_for_loader')
        ]
        app = FakeApplication()
        self.loader = PluginLoader(app, plugins_dir, [self.used_plugin_class])