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

Function write_validate_files

pants-plugins/api_spec/rules_test.py:242–265  ·  view source on GitHub ↗
(
    api_spec_dir: str,
    api_spec_file: str,
    contents: str,
    rc: int,
    rule_runner: RuleRunner,
)

Source from the content-addressed store, hash-verified

240
241
242def write_validate_files(
243 api_spec_dir: str,
244 api_spec_file: str,
245 contents: str,
246 rc: int,
247 rule_runner: RuleRunner,
248) -> None:
249 files = {
250 f"{api_spec_dir}/{api_spec_file}": contents,
251 f"{api_spec_dir}/BUILD": f"api_spec(name='t', source='{api_spec_file}')",
252 # add in the target that's hard-coded in the generate_api_spec_via_fmt rule
253 f"{ValidateApiSpec.directory}/{ValidateApiSpec.cmd}.py": VALIDATE_API_SPEC_PY.format(
254 api_spec_dir=api_spec_dir, rc=rc
255 ),
256 f"{ValidateApiSpec.directory}/BUILD": "python_sources()",
257 ValidateApiSpec.config_file: "",
258 }
259
260 module = ValidateApiSpec.directory
261 while module != ValidateApiSpec.source_root:
262 files[f"{module}/__init__.py"] = ""
263 module = os.path.dirname(module)
264
265 rule_runner.write_files(files)
266
267
268def test_validate_passed(rule_runner: RuleRunner) -> None:

Callers 2

test_validate_passedFunction · 0.85
test_validate_failedFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected