Skip to content

Commit a043522

Browse files
committed
fix offline command for gradle and maven
1 parent 19429de commit a043522

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

gitbugactions/actions/java/gradle_workflow.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ def _is_test_command(self, command) -> bool:
2222
return False
2323

2424
def instrument_test_steps(self):
25-
pass
25+
# Add an "--offline" option to the test command
26+
# FIXME: only when offline option is given
27+
if "jobs" in self.doc:
28+
for _, job in self.doc["jobs"].items():
29+
if "steps" in job:
30+
for step in job["steps"]:
31+
if "run" in step and self._is_test_command(step["run"]):
32+
step["run"] += " --offline"
2633

2734
def get_test_results(self, repo_path) -> List[TestCase]:
2835
parser = JUnitXMLParser()

gitbugactions/actions/java/maven_workflow.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ def _is_test_command(self, command) -> bool:
2222
return False
2323

2424
def instrument_test_steps(self):
25-
pass
25+
# Add an "--offline" option to the test command
26+
# FIXME: only when offline option is given
27+
if "jobs" in self.doc:
28+
for _, job in self.doc["jobs"].items():
29+
if "steps" in job:
30+
for step in job["steps"]:
31+
if "run" in step and self._is_test_command(step["run"]):
32+
step["run"] += " -offline"
2633

2734
def get_test_results(self, repo_path) -> List[TestCase]:
2835
parser = JUnitXMLParser()

gitbugs/bug.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def number_of_tests(runs):
179179
return (
180180
len(runs) > 0
181181
and len(failed_tests) == 0
182-
and number_of_tests(runs) > 0 # TODO: check against the number of tests in the bug info
182+
and number_of_tests(runs)
183+
> 0 # TODO: check against the number of tests in the bug info
183184
)
184185

185186
def __str__(self) -> str:

0 commit comments

Comments
 (0)