-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from dosaboy/func-tests-fix-target-name-handling
Fix func test target name identification
- Loading branch information
Showing
5 changed files
with
86 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
""" | ||
If a job has an accompanying vars section that specifies a tox command with | ||
target names we need to run those instead of the job name. | ||
""" | ||
import re | ||
import sys | ||
|
||
from common import OSCIConfig # pylint: disable=import-error | ||
|
||
|
||
def extract_job_target(testjob): | ||
""" | ||
Some jobs map directly to target names and some needs to be de-refenced by | ||
looking for the job definition and extracting the target from the tox | ||
command. Returns jobname if no dereference available. | ||
@param job: job name | ||
""" | ||
osci = OSCIConfig() | ||
job = osci.get_job(testjob) | ||
if not job or 'vars' not in job or 'tox_extra_args' not in job['vars']: | ||
return testjob | ||
|
||
ret = re.search(r"-- (.+)", | ||
str(job['vars']['tox_extra_args'])) | ||
if not ret: | ||
return testjob | ||
|
||
return ret.group(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
print(extract_job_target(sys.argv[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters