Skip to content

Commit 13e08fd

Browse files
Add missing file, ignore output files
1 parent 6775632 commit 13e08fd

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ betterproto/tests/*.py
1313
dist
1414
**/*.egg-info
1515
output
16+
betterproto/tests/output_*
17+
.idea

betterproto/tests/generate.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
import os
3+
4+
# Force pure-python implementation instead of C++, otherwise imports
5+
# break things because we can't properly reset the symbol database.
6+
os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python"
7+
8+
9+
from betterproto.tests.util import get_directories, protoc_plugin, protoc_reference, root_path
10+
11+
def main():
12+
os.chdir(root_path)
13+
test_cases_directory = os.path.join(root_path, 'inputs')
14+
test_case = get_directories(test_cases_directory)
15+
16+
for test_case_name in test_case:
17+
test_case_path = os.path.join(test_cases_directory, test_case_name)
18+
19+
case_reference_output_dir = os.path.join(root_path, 'output_reference', test_case_name)
20+
case_plugin_output_dir = os.path.join(root_path, 'output_betterproto', test_case_name)
21+
22+
print(f'Generating output for {test_case_name}')
23+
os.makedirs(case_reference_output_dir, exist_ok=True)
24+
os.makedirs(case_plugin_output_dir, exist_ok=True)
25+
26+
protoc_reference(test_case_path, case_reference_output_dir)
27+
protoc_plugin(test_case_path, case_plugin_output_dir)
28+
29+
30+
if __name__ == "__main__":
31+
main()

0 commit comments

Comments
 (0)