Skip to content

Commit

Permalink
PEP8 adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
chbrun committed Jul 18, 2014
1 parent f4d8d62 commit ccb3a38
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 104 deletions.
28 changes: 14 additions & 14 deletions testlinkconsole/libs/consoleBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ def read_config(self):
try:
setattr(self, variable, self.config.get(self.section, variable))
except Exception as e:
print e
print colored("Variable %s undefined in cfg file %s section %s" % (variable,self.configFile, self.section), 'red')
print(e)
print(colored("Variable %s undefined in cfg file %s section %s" % (variable,self.configFile, self.section), 'red'))

# config
def do_config(self, line):
for (variable, description) in self.LIST_VARIABLE.iteritems():
print "%25s : %s" % (description, colored(getattr(self, variable),'green'))
for variable, description in self.LIST_VARIABLE.iteritems():
print("%25s : %s" % (description, colored(getattr(self, variable),'green')))

def help_config(self):
print '\n'.join([ 'config',
print('\n'.join([ 'config',
'show configuration'
])
]))

# GET
def do_get(self, variable):
if variable not in self.LIST_VARIABLE.keys():
print colored('Variable not found','red')
print(colored('Variable not found','red'))
else:
print "%s : %s" % (variable,getattr(self, variable))
print("%s : %s" % (variable,getattr(self, variable)))

def help_get(self):
print '\n'.join([ 'get [variable]',
print('\n'.join([ 'get [variable]',
' show variable value'
])
]))

def complete_get(self, text, line, begids, endidx):
if not text:
Expand All @@ -63,9 +63,9 @@ def do_set(self, arg):
setattr(self, variable, value)

def help_set(self):
print '\n'.join([ 'set [variable] [value]',
print('\n'.join([ 'set [variable] [value]',
'set variable with value'
])
]))

def complete_set(self, text, line, begidx, endidx):
return self.complete_get(text, line, begidx, endidx)
Expand All @@ -79,7 +79,7 @@ def do_save(self, line):
self.config.write(configfile)

def help_save(self):
print '\n'.join([ 'save',
print('\n'.join([ 'save',
'save config'
])
]))

8 changes: 4 additions & 4 deletions testlinkconsole/plugins/bdlocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ def deactivate(self):
return "BDLocal plugin inactif"

def run(self, browser, script):
print "BDLocal run %s with %s" % (script, browser)
print("BDLocal run %s with %s" % (script, browser))

@staticmethod
def do_createlocal(self,line ):
print "Bonjour du plugins"
print("Bonjour du plugins")

@staticmethod
def help_createlocal(self):
print '\n'.join([' createlocal plugins',
print('\n'.join([' createlocal plugins',
'juste un test pour le fun'
])
]))
6 changes: 3 additions & 3 deletions testlinkconsole/plugins/behat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ def deactivate(self):
super(BehatPlugin, self).deactivate()
return "Behat plugin inactif"

def getFileResult(self, script):
def get_fileresult(self, script):
return script.split('/')[-1].split('.')[0]

def run(self, profile, script):
behat='behat --profile %s --format=junit --out=./result/%s/ features/%s' % (profile,profile,script)
return os.system(behat)

def result(self, profile, script):
fileResult = self.getFileResult(script)
fileResult = self.get_fileresult(script)
resultFinal = ''
testCaseList=[]
notes=''
Expand All @@ -46,7 +46,7 @@ def result(self, profile, script):
for failure in failuresList:
notes = notes + ' Erreur : '+failure.getAttribute('message')+'\n'
notes = notes + '\n'
return (resultFinal, notes)
return resultFinal, notes



Expand Down
2 changes: 1 addition & 1 deletion testlinkconsole/plugins/behave.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def deactivate(self):
return "Behave plugin inactif"

def run(self, browser, script):
print "Behave run %s with %s" % (script, browser)
print("Behave run %s with %s" % (script, browser))
14 changes: 9 additions & 5 deletions testlinkconsole/plugins/ptestlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def deactivate(self):
return "Testlink plugin inactif"

def run(self, browser, script):
print "Testlink run %s with %s" % (script, browser)
print("Testlink run %s with %s" % (script, browser))

def listProjects(self):
def list_projects(self):
result=[]
for project in self.testlinkclient.getProjects():
result.append(
Expand All @@ -41,7 +41,7 @@ def listProjects(self):
})
return result

def listTestPlans(self, projectid):
def list_testplans(self, projectid):
result=[]
for testplan in self.testlinkclient.getProjectTestPlans(testprojectid=projectid):
result.append(
Expand All @@ -51,9 +51,13 @@ def listTestPlans(self, projectid):
})
return result

def listTestCases(self, testplanid):
def list_testcases(self, testplanid):
result=[]
for (testcaseid, testcase) in self.testlinkclient.getTestCasesForTestPlan(testplanid=testplanid, execution_type=2).items():
testcases = self.testlinkclient.getTestCasesForTestPlan(
testplanid=testplanid,
execution_type=2
)
for testcaseid, testcase in testcases.items():
result.append(
{
'id' : testcase[0]['tcase_id'],
Expand Down
7 changes: 4 additions & 3 deletions testlinkconsole/testlinkclient.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[testlink]
serverurl = http://testlink.localhost/lib/api/xmlrpc/v1/xmlrpc.php
serverurl = http://testlink.owsi-vm-polephp.accelance.net/lib/api/xmlrpc/v1/xmlrpc.php
serverkey = de33e9acbc5af2129f34ae522e050993
projetid = 0
campagneid = 0
projectid = 1
testplanid = 1548
output = 0
runner = BehatPlugin
storage = TestlinkPlugin

0 comments on commit ccb3a38

Please sign in to comment.