removed unused code
This commit is contained in:
parent
92410beb4f
commit
f749bb101f
1 changed files with 0 additions and 73 deletions
|
@ -62,82 +62,9 @@ class AndroidTestReporter(TreeReporter):
|
|||
def str_to_basic_html(value):
|
||||
return value.replace("\n", "<br>").replace(" ", ' ')
|
||||
|
||||
def _parseLocalVariables(line):
|
||||
"""
|
||||
Accepts a single line in Emacs local variable declaration format and
|
||||
returns a dict of all the variables {name: value}.
|
||||
Raises ValueError if 'line' is in the wrong format.
|
||||
See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
|
||||
"""
|
||||
paren = '-*-'
|
||||
start = line.find(paren) + len(paren)
|
||||
end = line.rfind(paren)
|
||||
if start == -1 or end == -1:
|
||||
raise ValueError("%r not a valid local variable declaration" % (line,))
|
||||
items = line[start:end].split(';')
|
||||
localVars = {}
|
||||
for item in items:
|
||||
if len(item.strip()) == 0:
|
||||
continue
|
||||
split = item.split(':')
|
||||
if len(split) != 2:
|
||||
raise ValueError("%r contains invalid declaration %r"
|
||||
% (line, item))
|
||||
localVars[split[0].strip()] = split[1].strip()
|
||||
return localVars
|
||||
|
||||
def isTestFile(filename):
|
||||
"""
|
||||
Returns true if 'filename' looks like a file containing unit tests.
|
||||
False otherwise. Doesn't care whether filename exists.
|
||||
"""
|
||||
basename = os.path.basename(filename)
|
||||
return (basename.startswith('test_')
|
||||
and os.path.splitext(basename)[1] == ('.py'))
|
||||
|
||||
def loadLocalVariables(filename):
|
||||
"""
|
||||
Accepts a filename and attempts to load the Emacs variable declarations
|
||||
from that file, simulating what Emacs does.
|
||||
See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
|
||||
"""
|
||||
with open(filename, "r") as f:
|
||||
lines = [f.readline(), f.readline()]
|
||||
for line in lines:
|
||||
try:
|
||||
return _parseLocalVariables(line)
|
||||
except ValueError:
|
||||
pass
|
||||
return {}
|
||||
|
||||
def getTestModules(filename):
|
||||
testCaseVar = loadLocalVariables(filename).get('test-case-name', None)
|
||||
if testCaseVar is None:
|
||||
return []
|
||||
return testCaseVar.split(',')
|
||||
|
||||
def run():
|
||||
loader = TestLoader();
|
||||
suite = loader.loadPackage(lbrynet.tests, True)
|
||||
|
||||
|
||||
filename = '/data/user/0/io.lbry.lbrynet/files/app/lib/python2.7/site-packages/lbrynet/tests'
|
||||
filelist = listdir(filename)
|
||||
print filelist
|
||||
'''
|
||||
tests = []
|
||||
if not os.path.isfile(filename):
|
||||
sys.stderr.write("File %r doesn't exist\n" % (filename,))
|
||||
return
|
||||
|
||||
filename = os.path.abspath(filename)
|
||||
if isTestFile(filename):
|
||||
tests.append(filename)
|
||||
else:
|
||||
tests.extend(getTestModules(filename))
|
||||
|
||||
suite = loader.loadByNames(tests, True)
|
||||
'''
|
||||
runner = TrialRunner(AndroidTestReporter)
|
||||
runner.stream = str_stream
|
||||
passFail = not runner.run(suite).wasSuccessful()
|
||||
|
|
Loading…
Add table
Reference in a new issue