Skip to content

Commit

Permalink
Merge pull request #76 from takenori-y/python_m
Browse files Browse the repository at this point in the history
Support for running with the -m option
  • Loading branch information
LilSpazJoekp authored Aug 23, 2024
2 parents 9eb565b + 14ad9b3 commit 8ffd737
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docstrfmt/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from docstrfmt.main import main # pragma: no cover

main() # pragma: no cover
18 changes: 18 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
import sys

import pytest
Expand Down Expand Up @@ -30,6 +31,23 @@ def test_check(runner, file):
)


@pytest.mark.parametrize(
"file", ["tests/test_files/test_file.rst", "tests/test_files/py_file.py"]
)
def test_call(file):
args = ["-c", "-l", "80", os.path.abspath(file)]
result = subprocess.run(
[sys.executable, "-m", "docstrfmt", *args],
stderr=subprocess.PIPE,
text=True,
encoding="unicode-escape" if os.name == "nt" else None,
)
assert result.returncode == 1
assert result.stderr.endswith(
"could be reformatted.\n1 out of 1 file could be reformatted.\nDone! 🎉\n"
)


@pytest.mark.parametrize("flag", [True, False])
def test_docstring_trailing_line(runner, flag):
args = [
Expand Down

0 comments on commit 8ffd737

Please sign in to comment.