(self, name, decode=True, args=None)
| 78 | return fp.read() |
| 79 | |
| 80 | def scan_test_file(self, name, decode=True, args=None): |
| 81 | if name.startswith("mirror://"): |
| 82 | pth = name |
| 83 | else: |
| 84 | pth = os.fspath(self.path(name)) |
| 85 | |
| 86 | cmd = ["scan", pth] |
| 87 | |
| 88 | if args: |
| 89 | cmd += args |
| 90 | |
| 91 | if ("--format" not in cmd) and ("-f" not in cmd): |
| 92 | cmd += ["--format", "json"] |
| 93 | |
| 94 | result = self.get_cli_output(cmd) |
| 95 | if decode: |
| 96 | try: |
| 97 | return json.loads(result.output) |
| 98 | except Exception: |
| 99 | print(result.output, file=sys.stdout) |
| 100 | raise |
| 101 | else: |
| 102 | return result |
| 103 | |
| 104 | def get_cli_output(self, args, check_exit_code=True) -> Result: |
| 105 | global cli |
no test coverage detected