Created
August 28, 2020 20:30
-
-
Save leandroBorgesFerreira/5d7fe4fdd9316f1a62c23a22f10aeda6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import os | |
| import json | |
| def parse_modules(modules_file): | |
| modules = [] | |
| with open(modules_file, 'r') as file: | |
| return json.loads(file.read()) | |
| def parse_unit_test_command(modules): | |
| command = "./gradlew " | |
| for module in modules: | |
| command += module + ":testDebug" | |
| command += " " | |
| return command | |
| def dag_unit_tests(): | |
| """Runs unit tests only in specific modules""" | |
| modules = parse_modules("./affected-modules.json") | |
| if len(modules) == 0: | |
| print("No modules. No unit test need to be run") | |
| else: | |
| print(parse_unit_test_command(modules)) | |
| # result = os.system(parse_unit_test_command(modules)) | |
| result = 0 | |
| if result != 0: | |
| raise(Exception("unit tests failed")) | |
| dag_unit_tests() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment