Skip to content

Commit

Permalink
change test format
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed Oct 3, 2023
1 parent 7a3f173 commit 01a04b9
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions tests/test_language_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ def test_release_please_handle_releases():
)


def test_merge_partials():
os.chdir(FIXTURES / "java_templates" / "partials")
with util.copied_fixtures_dir(FIXTURES / "java_templates" / "partials"):
java.common_templates(
template_path=TEMPLATES_PATH,
partial_files=[".kokoro/nightly/integration.cfg-partials.yaml"]
)
assert os.path.isfile(".kokoro/nightly/integration.cfg")
os.system("cat .kokoro/nightly/integration.cfg")
assert_matches_golden(
"integration-golden.cfg", ".kokoro/nightly/integration.cfg"
)


def assert_matches_golden(expected, actual):
matching_lines = 0
with open(actual, "rt") as fp:
Expand All @@ -268,18 +282,3 @@ def assert_matches_golden(expected, actual):
if not log_line:
break
assert matching_lines > 0


class TestJava(unittest.TestCase):
def test_merge_partials(self):
os.chdir(FIXTURES / "java_templates" / "partials")
with util.copied_fixtures_dir(FIXTURES / "java_templates" / "partials"):
java.common_templates(
template_path=TEMPLATES_PATH,
partial_files=[".kokoro/nightly/integration.cfg-partials.yaml"]
)
assert os.path.isfile(".kokoro/nightly/integration.cfg")
os.system("cat .kokoro/nightly/integration.cfg")
assert_matches_golden(
"integration-golden.cfg", ".kokoro/nightly/integration.cfg"
)

0 comments on commit 01a04b9

Please sign in to comment.