Conversation
| stdout: str | ||
| stderr: str | ||
|
|
||
| def __init__(self, subprocess_output: subprocess.CompletedProcess) -> None: |
There was a problem hiding this comment.
I think, adding method __init__ to a dataclass could be problematic.
| ) | ||
|
|
||
|
|
||
| PipAuditEntry = dict[str, str | list[str] | tuple[str, ...]] |
There was a problem hiding this comment.
Improve readability and reduce typing effort in type hints.
| references_subsection = f"\n#### References:\n\n* {links_join}\n\n " | ||
| subsection = f"### {self.vulnerability_id} in {self.package.coordinates}\n\n{self.description}\n{references_subsection}" | ||
| return cleandoc(subsection.strip()) | ||
| indent = " " * 12 |
There was a problem hiding this comment.
Using a cleandoc and some indent magic improves readability.
| ) | ||
|
|
||
|
|
||
| def aux_subprocess(*cmd, **kwargs) -> subprocess.CompletedProcess: |
There was a problem hiding this comment.
There were multiple calls to suprocess.run().
The following approach
- minimizes code-duplication
- defines defaults for crucial kwargs like
checkandcapture_outputin a central place capture_outputreduces clutter in pytest output when running the test locally
| return subprocess.run(cmd, **kwargs_with_defaults) | ||
|
|
||
|
|
||
| class PoetryProject: |
There was a problem hiding this comment.
This class is a bit longer than the original implementation.
But it improves readability by using method-chaining to express the setup of the sample project under test.
|
| def set_minimum_python_version(self, version: str) -> PoetryProject: | ||
| content = self.toml.read_text() | ||
| changed = re.sub( | ||
| r'^requires-python = ".*"$', |
There was a problem hiding this comment.
| r'^requires-python = ".*"$', | |
| r'^requires-python\s*=\s*".*"$', |



Closes #750
Checklist
Note: If any of the items in the checklist are not relevant to your PR, just check the box.
For any Pull Request
Is the following correct:
When Changes Were Made
Did you:
When Preparing a Release
Have you: