Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Incomplete PR to support new RF and SeleniumLiumrary #230

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
language: python
python:
- "2.7"
matrix:
include:
- python: "2.7"
env:
- INTERPRETER=python2

install:
- pip install robotframework
- pip install robotframework-selenium2library==1.8.0
- pip install future
- pip install robotframework==3.0.3
- pip install robotframework-seleniumlibrary==3.1.1
script:
- "python test/run_test.py"
- "$INTERPRETER --version"
- "$INTERPRETER test/run_test.py"
3 changes: 2 additions & 1 deletion Robot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Robot Framework from sublime is a autocompletion plugin for Sublime Text 3
Robot Framework Assistant offers IDE features for editing Robot Framework test
data in Sublime Text 3.
"""
import sys
import os
Expand Down
8 changes: 8 additions & 0 deletions command_helper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .completions import (check_prefix, get_completion_list,
get_kw_completion_list)
from .get_documentation import GetKeywordDocumentation
from .get_keyword import GetKeyword
from .get_metadata import get_rf_table_separator
from .jump_to_file import JumpToFile
from .noralize_cell import ReturnKeywordAndObject
from .workspace_objects import WorkSpaceObjects
9 changes: 3 additions & 6 deletions command_helper/completions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import re
import difflib
from json import load as json_load
try:
from db_json_settings import DBJsonSetting
from utils.get_text import get_prefix
except:
from ..setting.db_json_settings import DBJsonSetting
from ..command_helper.utils.get_text import get_prefix

from RobotFrameworkAssistant.dataparser import DBJsonSetting
from RobotFrameworkAssistant.command_helper.utils import get_prefix


def check_prefix(line, column, prefix):
Expand Down
19 changes: 7 additions & 12 deletions command_helper/get_documentation.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import collections
from os import path
try:
from parser_utils.file_formatter import rf_table_name
from parser_utils.util import get_index_name, normalise_path
from noralize_cell import get_data_from_json
from db_json_settings import DBJsonSetting
from utils.util import kw_equals_kw_candite
except:
from ..dataparser.parser_utils.file_formatter import rf_table_name
from ..dataparser.parser_utils.util import get_index_name, normalise_path
from ..command_helper.noralize_cell import get_data_from_json
from ..setting.db_json_settings import DBJsonSetting
from ..command_helper.utils.util import kw_equals_kw_candite

from RobotFrameworkAssistant.command_helper.noralize_cell import get_data_from_json
from RobotFrameworkAssistant.command_helper.utils import kw_equals_kw_candite
from RobotFrameworkAssistant.dataparser import DBJsonSetting
from RobotFrameworkAssistant.dataparser.parser_utils import (rf_table_name,
get_index_name,
normalise_path)


class GetKeywordDocumentation(object):
Expand Down
19 changes: 8 additions & 11 deletions command_helper/get_keyword.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import re
from os import path
from sys import version_info
try:
from get_documentation import GetKeywordDocumentation
from db_json_settings import DBJsonSetting
from noralize_cell import get_data_from_json
from utils.util import kw_equals_kw_candite
except:
from .get_documentation import GetKeywordDocumentation
from ..setting.db_json_settings import DBJsonSetting
from ..command_helper.noralize_cell import get_data_from_json
from ..command_helper.utils.util import kw_equals_kw_candite

from RobotFrameworkAssistant.command_helper import GetKeywordDocumentation
from RobotFrameworkAssistant.command_helper.noralize_cell import get_data_from_json
from RobotFrameworkAssistant.command_helper.utils import kw_equals_kw_candite
from RobotFrameworkAssistant.dataparser import DBJsonSetting


class GetKeyword(object):
Expand Down Expand Up @@ -85,7 +80,9 @@ def get_lib_keyword_file(self, table_path, object_name, keyword):
table_kw_object = data[DBJsonSetting.library_module]
for table_kw_data in table_keywords:
if kw_equals_kw_candite(keyword, table_kw_data):
if not object_name or object_name == table_kw_object:
if table_kw_object == object_name:
return table_keywords[table_kw_data][DBJsonSetting.keyword_file]
elif not object_name:
return table_keywords[table_kw_data][DBJsonSetting.keyword_file]

def get_regex_library(self, keyword):
Expand Down
8 changes: 2 additions & 6 deletions command_helper/jump_to_file.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import os
import re

try:
from parser_utils.file_formatter import lib_table_name
from noralize_cell import get_data_from_json
except ImportError:
from ..dataparser.parser_utils.file_formatter import lib_table_name
from .noralize_cell import get_data_from_json
from RobotFrameworkAssistant.command_helper.noralize_cell import get_data_from_json
from RobotFrameworkAssistant.dataparser.parser_utils import lib_table_name


class JumpToFile(object):
Expand Down
10 changes: 4 additions & 6 deletions command_helper/noralize_cell.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import re
import collections
try:
from utils.util import get_data_from_json, kw_equals_kw_candite
from db_json_settings import DBJsonSetting
except:
from .utils.util import get_data_from_json, kw_equals_kw_candite
from ..setting.db_json_settings import DBJsonSetting

from RobotFrameworkAssistant.command_helper.utils import (get_data_from_json,
kw_equals_kw_candite)
from RobotFrameworkAssistant.dataparser import DBJsonSetting


class ReturnKeywordAndObject(object):
Expand Down
2 changes: 2 additions & 0 deletions command_helper/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .get_text import get_line, get_prefix, get_object_from_line
from .util import get_data_from_json, kw_equals_kw_candite
24 changes: 11 additions & 13 deletions command_helper/utils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@


def get_data_from_json(json_file):
f = open(json_file)
data = json_load(f)
f.close()
return data
with open(json_file) as f:
return json_load(f)


def _keyword_with_embedded_arg(kw, kw_candite):
Expand All @@ -24,14 +22,14 @@ def _keyword_no_embedded_arg(kw, kw_candite):


def kw_equals_kw_candite(kw, kw_candite):
"""Returns True if kw == kw_canditate
"""Returns True if kw == kw_canditate

Spaces, under score are removed and
strings are converted to lower before validation.
Spaces, under score are removed and
strings are converted to lower before validation.

Also support keyword conditate with emedded args
"""
if '$' in kw_candite:
return _keyword_with_embedded_arg(kw, kw_candite)
else:
return _keyword_no_embedded_arg(kw, kw_candite)
Also support keyword conditate with emedded args
"""
if '$' in kw_candite:
return _keyword_with_embedded_arg(kw, kw_candite)
else:
return _keyword_no_embedded_arg(kw, kw_candite)
9 changes: 3 additions & 6 deletions command_helper/workspace_objects.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from os import listdir, path
try:
from noralize_cell import get_data_from_json
from db_json_settings import DBJsonSetting
except:
from ..command_helper.noralize_cell import get_data_from_json
from ..setting.db_json_settings import DBJsonSetting

from RobotFrameworkAssistant.command_helper.noralize_cell import get_data_from_json
from RobotFrameworkAssistant.dataparser import DBJsonSetting


class WorkSpaceObjects(object):
Expand Down
6 changes: 3 additions & 3 deletions commands/command_logging.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sublime_plugin
import sublime
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
import sublime_plugin

from ..setting import get_setting, SettingObject


class LogCommands(sublime_plugin.TextCommand):
Expand Down
15 changes: 7 additions & 8 deletions commands/index_open_tab.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import sublime_plugin
import sublime
import subprocess
from platform import system
from os import path, makedirs
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
from ..dataparser.parser_utils.file_formatter import rf_table_name
from ..dataparser.parser_utils.util import normalise_path
from .scan_and_index import index_popen_arg_parser
from .scan_and_index import add_builtin_vars

import sublime_plugin
import sublime

from .scan_and_index import index_popen_arg_parser, add_builtin_vars
from ..setting import get_setting, SettingObject
from ..dataparser.parser_utils import rf_table_name, normalise_path


class IndexOpenTabCommand(sublime_plugin.TextCommand):
Expand Down
4 changes: 2 additions & 2 deletions commands/on_save_create_table.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sublime_plugin
import sublime
from ..setting.setting import get_setting
from ..setting.setting import SettingObject

from ..setting import get_setting, SettingObject


class OnSaveCreateTable(sublime_plugin.EventListener):
Expand Down
2 changes: 1 addition & 1 deletion commands/open_log_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sublime
import sublime_plugin

from ..setting.setting import get_log_file
from RobotFrameworkAssistant.setting import get_log_file


class OpenLogFile(sublime_plugin.TextCommand):
Expand Down
18 changes: 9 additions & 9 deletions commands/query_completions.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from os import path

import sublime_plugin
import sublime
from os import path

from ..command_helper.completions import get_completion_list, check_prefix
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
from ..setting.db_json_settings import DBJsonSetting
from ..dataparser.parser_utils.file_formatter import rf_table_name
from ..dataparser.parser_utils.util import get_index_name, normalise_path
from ..command_helper.utils.get_text import get_line
from ..command_helper.utils.get_text import get_object_from_line
from ..command_helper.get_metadata import get_rf_table_separator
from ..setting import SettingObject, get_setting
from ..dataparser import DBJsonSetting
from ..dataparser.parser_utils import rf_table_name, get_index_name, normalise_path
from ..command_helper.utils import get_line, get_object_from_line
from ..command_helper import get_rf_table_separator

SNIPPET_TRIGGER = [':f', '*', ':']

Expand Down Expand Up @@ -46,6 +45,7 @@ def return_completions(self, view, prefix, locations):
# workspace = get_setting(SettingObject.workspace)
open_tab = view.file_name()
index_file = get_index_file(open_tab)
print(view, prefix, index_file)
if index_file:
return self.get_completions(view, prefix, index_file)
else:
Expand Down
10 changes: 6 additions & 4 deletions commands/scan.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import sublime_plugin
import sublime
import subprocess
from platform import system
from os import path, makedirs
from ..setting.setting import get_setting
from ..setting.setting import SettingObject

import sublime_plugin
import sublime

from RobotFrameworkAssistant.setting import get_setting, SettingObject


def scan_popen_arg_parser(mode):
Expand Down Expand Up @@ -48,6 +49,7 @@ def run_scan(self, log_file):
p_args = scan_popen_arg_parser('all')
p_args.append('--workspace')
p_args.append(get_setting(SettingObject.workspace))
print(p_args)
p = subprocess.Popen(
p_args,
stderr=subprocess.STDOUT,
Expand Down
15 changes: 8 additions & 7 deletions commands/scan_and_index.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import sublime_plugin
import sublime
import json
import subprocess
from hashlib import md5
from platform import system
from os import path, makedirs
from hashlib import md5
import json
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
from ..setting.db_json_settings import DBJsonSetting

import sublime_plugin
import sublime

from ..setting import get_setting, SettingObject
from ..dataparser import DBJsonSetting


def index_popen_arg_parser(mode):
Expand Down
11 changes: 6 additions & 5 deletions commands/scan_open_tab.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import sublime_plugin
import sublime
import subprocess
from platform import system
from os import path, makedirs
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
from platform import system

import sublime_plugin
import sublime

from ..setting import get_setting, SettingObject
from .scan import scan_popen_arg_parser


Expand Down
15 changes: 8 additions & 7 deletions commands/setting_import_helper.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import sublime_plugin
import sublime
import re
from os import path
from ..setting.setting import get_setting
from ..setting.setting import SettingObject
from ..command_helper.utils.get_text import get_line
from ..setting.db_json_settings import DBJsonSetting
from ..command_helper.workspace_objects import WorkSpaceObjects

import sublime_plugin
import sublime

from ..setting import get_setting, SettingObject
from ..command_helper.utils import get_line
from ..dataparser import DBJsonSetting
from ..command_helper import WorkSpaceObjects


class SettingImporter(sublime_plugin.TextCommand):
Expand Down
12 changes: 6 additions & 6 deletions commands/show_documentation.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import sublime_plugin
import sublime
from ..setting.setting import get_setting
from ..setting.setting import SettingObject

from ..setting import get_setting, SettingObject
from .query_completions import get_index_file
from ..command_helper.utils.get_text import get_line
from ..command_helper.noralize_cell import ReturnKeywordAndObject
from ..command_helper.get_metadata import get_rf_table_separator
from ..command_helper.get_documentation import GetKeywordDocumentation
from ..command_helper.utils import get_line
from ..command_helper import ReturnKeywordAndObject
from ..command_helper import get_rf_table_separator
from ..command_helper import GetKeywordDocumentation


class ShowKeywordDocumentation(sublime_plugin.TextCommand):
Expand Down
1 change: 1 addition & 0 deletions dataparser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Robot Framework is installed. These modules must not be run the from the
Python included in the Sublime Text
"""
from .db_json_settings import DBJsonSetting
1 change: 1 addition & 0 deletions dataparser/data_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .data_parser import DataParser, strip_and_lower
Loading