Skip to content

Instantly share code, notes, and snippets.

@leandroBorgesFerreira
Created August 28, 2020 20:30
Show Gist options
  • Select an option

  • Save leandroBorgesFerreira/5d7fe4fdd9316f1a62c23a22f10aeda6 to your computer and use it in GitHub Desktop.

Select an option

Save leandroBorgesFerreira/5d7fe4fdd9316f1a62c23a22f10aeda6 to your computer and use it in GitHub Desktop.
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