-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathtest_generate_module_notes.py
More file actions
62 lines (51 loc) · 1.68 KB
/
test_generate_module_notes.py
File metadata and controls
62 lines (51 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import subprocess
import unittest
from pathlib import Path
class TestGenerateModuleNotes(unittest.TestCase):
def setUp(self):
self.script_path = Path(
".github/release-note-generation/generate_module_notes.py"
)
self.testdata_dir = Path(".github/release-note-generation/testdata")
def test_java_run_generation(self):
golden_file = self.testdata_dir / "golden_java-run_0.71.0.txt"
with open(golden_file, "r") as f:
expected_output = f.read()
cmd = [
"python3",
str(self.script_path),
"--module",
"google-cloud-run",
"--directory",
"java-run",
"--version",
"0.71.0",
"--short-name",
"run",
]
result = subprocess.run(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
)
self.assertEqual(result.returncode, 0)
self.assertEqual(result.stdout, expected_output)
def test_root_generation(self):
golden_file = self.testdata_dir / "golden_root_1.85.0.txt"
with open(golden_file, "r") as f:
expected_output = f.read()
cmd = [
"python3",
str(self.script_path),
"--module",
"google-cloud-java",
"--directory",
".",
"--version",
"1.85.0",
]
result = subprocess.run(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
)
self.assertEqual(result.returncode, 0)
self.assertEqual(result.stdout, expected_output)
if __name__ == "__main__":
unittest.main()