MCPcopy Index your code
hub / github.com/StackStorm/st2 / write_generate_files

Function write_generate_files

pants-plugins/api_spec/rules_test.py:168–191  ·  view source on GitHub ↗
(
    api_spec_dir: str,
    api_spec_file: str,
    before: str,
    after: str,
    rule_runner: RuleRunner,
)

Source from the content-addressed store, hash-verified

166
167
168def write_generate_files(
169 api_spec_dir: str,
170 api_spec_file: str,
171 before: str,
172 after: str,
173 rule_runner: RuleRunner,
174) -> None:
175 files = {
176 f"{api_spec_dir}/{api_spec_file}": before,
177 f"{api_spec_dir}/BUILD": f"api_spec(name='t', source='{api_spec_file}')",
178 # add in the target that's hard-coded in the generate_api_spec_via_fmt rule
179 f"{GenerateApiSpec.directory}/{GenerateApiSpec.cmd}.py": GENERATE_API_SPEC_PY.format(
180 api_spec_dir=api_spec_dir, api_spec_text=after
181 ),
182 f"{GenerateApiSpec.directory}/BUILD": "python_sources()",
183 GenerateApiSpec.config_file: "",
184 }
185
186 module = GenerateApiSpec.directory
187 while module != GenerateApiSpec.source_root:
188 files[f"{module}/__init__.py"] = ""
189 module = os.path.dirname(module)
190
191 rule_runner.write_files(files)
192
193
194def test_generate_changed(rule_runner: RuleRunner) -> None:

Callers 2

test_generate_changedFunction · 0.85
test_generate_unchangedFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected