Skip to content

Commit

Permalink
test: Ignore subprocess warning in test file
Browse files Browse the repository at this point in the history
This test file uses `subprocess.run()` to run the examples and check
their output.  The input to `run()` has been verified and is not a
security vulnerability.
  • Loading branch information
jmgate committed Jul 3, 2024
1 parent 3411062 commit 90e3cad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions example/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_basic() -> None:
"""Ensure ``basic.py`` produces the expected results."""
example = Path(__file__).parent / "basic.py"
result = subprocess.run(
[example, "--foo", "bar"], # noqa: S603
[example, "--foo", "bar"],
capture_output=True,
check=True,
text=True,
Expand All @@ -36,7 +36,7 @@ def test_default_values() -> None:
"""Ensure ``default_values.py`` produces the expected results."""
example = Path(__file__).parent / "default_values.py"
result = subprocess.run(
[example, "--foo", "bar"], # noqa: S603
[example, "--foo", "bar"],
capture_output=True,
check=True,
text=True,
Expand All @@ -54,7 +54,7 @@ def test_relative_references() -> None:
"""Ensure ``relative_references.py`` produces the expected results."""
example = Path(__file__).parent / "relative_references.py"
result = subprocess.run(
[example, "--src", "bar.txt"], # noqa: S603
[example, "--src", "bar.txt"],
capture_output=True,
check=True,
text=True,
Expand All @@ -73,7 +73,7 @@ def test_post_processing() -> None:
"""Ensure ``post_processing.py`` produces the expected results."""
example = Path(__file__).parent / "post_processing.py"
result = subprocess.run(
[example, "--before", "'30 minutes ago'"], # noqa: S603
[example, "--before", "'30 minutes ago'"],
capture_output=True,
check=True,
text=True,
Expand All @@ -96,7 +96,7 @@ def test_pretty_printing() -> None:
"""Ensure ``pretty_printing.py`` produces the expected results."""
example = Path(__file__).parent / "pretty_printing.py"
result = subprocess.run(
[ # noqa: S603
[
example,
"--foo",
"eggs",
Expand Down Expand Up @@ -132,7 +132,7 @@ def test_subparsers() -> None:
"""Ensure ``subparsers.py`` produces the expected results."""
example = Path(__file__).parent / "subparsers.py"
result = subprocess.run(
[example, "foo", "--one", "eggs"], # noqa: S603
[example, "foo", "--one", "eggs"],
capture_output=True,
check=True,
text=True,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
"**/test_*.py" = ["S101"]
"example/*.py" = ["S603"]


[tool.ruff.lint.pydocstyle]
Expand Down

0 comments on commit 90e3cad

Please sign in to comment.