diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..b2da329 --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,31 @@ +name: unit tests + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest coverage + - name: Test with pyment + run: | + coverage run --source pyment -m pytest -s tests + - name: Generate Coverage Report + run: | + coverage report diff --git a/README.rst b/README.rst index 94f1a02..f651dec 100644 --- a/README.rst +++ b/README.rst @@ -10,14 +10,14 @@ Project Status **Test Status** -Linux: |travis| +Linux: |github| Windows: |appveyor| -.. |travis| image:: https://travis-ci.org/dadadel/pyment.svg?branch=master - :target: https://travis-ci.org/dadadel/pyment.svg?branch=master - :alt: Linux tests (TravisCI) +.. |github| image:: https://github.com/dadadel/pyment/actions/workflows/run_tests.yml/badge.svg + :target: https://github.com/dadadel/pyment/actions/workflows/run_tests.yml/badge.svg + :alt: Linux tests (Github Actions) .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/f9d4jps5fkf4m42h?svg=true :target: https://ci.appveyor.com/api/projects/status/f9d4jps5fkf4m42h?svg=true @@ -39,6 +39,18 @@ Windows: |appveyor| .. image:: https://img.shields.io/badge/python-3.9-blue.svg :target: https://img.shields.io/badge/python-3.9-blue.svg :alt: Supports Python39 +.. image:: https://img.shields.io/badge/python-3.10-blue.svg + :target: https://img.shields.io/badge/python-3.10-blue.svg + :alt: Supports Python310 +.. image:: https://img.shields.io/badge/python-3.11-blue.svg + :target: https://img.shields.io/badge/python-3.11-blue.svg + :alt: Supports Python311 +.. image:: https://img.shields.io/badge/python-3.12-blue.svg + :target: https://img.shields.io/badge/python-3.12-blue.svg + :alt: Supports Python312 +.. image:: https://img.shields.io/badge/python-3.13-blue.svg + :target: https://img.shields.io/badge/python-3.13-blue.svg + :alt: Supports Python313 | diff --git a/pyment/docstring.py b/pyment/docstring.py index 2361137..5e86fec 100644 --- a/pyment/docstring.py +++ b/pyment/docstring.py @@ -452,7 +452,7 @@ class GoogledocTools(DocToolsBase): """ """ def __init__(self, first_line=None, - optional_sections=('raise'), + optional_sections=('raise',), excluded_sections=()): """ :param first_line: indicate if description should start diff --git a/tests/issue51.py b/tests/issue51.py index e53ae98..4246e0d 100644 --- a/tests/issue51.py +++ b/tests/issue51.py @@ -6,7 +6,7 @@ def foo(): Returns: Raises: - test + test """ pass diff --git a/tests/issue88.py.patch b/tests/issue88.py.patch index 331cfc3..db9de3f 100644 --- a/tests/issue88.py.patch +++ b/tests/issue88.py.patch @@ -28,8 +28,8 @@ async def async_func3(param1, param2=None): - """ -- somme comment -+ """somme comment +- some comment ++ """some comment + :param param1: my parameter 1 - :param param2: my second param diff --git a/tests/test_app.py b/tests/test_app.py index 4876afe..fb694e5 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -48,9 +48,7 @@ def func(): Args: Returns: - ret type: smthg - - Raises: + ret type: smthg """ pass @@ -64,7 +62,7 @@ def func(): --- a/- +++ b/- - @@ -3,9 +3,12 @@ + @@ -3,9 +3,10 @@ def func(): """First line @@ -73,9 +71,7 @@ def func(): - :rtype: ret type + Returns: - + ret type: smthg - + - + Raises: + + ret type: smthg """ @@ -224,7 +220,7 @@ def testNoArgs_ge_py33(self): write_to_stdin=None, # expected_stderr=re.compile('too few arguments'), expected_stderr=re.compile( - r'usage: pymentapp.py \[-h\] \[-i style\] \[-o style\] \[-q quotes\] \[-f status\] \[-t\].?.?\s{20}\[-c config\] \[-d\] \[-p status\] \[-v\] \[-w\].?.?\s{20}path.?.?pymentapp\.py: error: the following arguments are required: path', + r'usage: pymentapp.py \[-h\] \[-i style\] \[-o style\] \[-q quotes\] \[-f status\] \[-t\].?.?\s{20}\[-c config\] \[-d\] \[-p status\] \[-v\] \[-w\] \[-s spaces\] \[-e\].?.?\s{20}path.?.?pymentapp\.py: error: the following arguments are required: path', re.DOTALL), expected_returncode=2 ) diff --git a/tests/test_pyment_cases.py b/tests/test_pyment_cases.py index 5f305c0..63b4730 100644 --- a/tests/test_pyment_cases.py +++ b/tests/test_pyment_cases.py @@ -47,7 +47,6 @@ def testCaseGenAllParamsReST(self): result = ''.join(p.diff()) self.assertTrue(remove_diff_header(result) == remove_diff_header(expected)) - @unittest.expectedFailure def testCaseGenAllParamsGoogle(self): # The file has several functions with no or several parameters, # so Pyment should produce docstrings in google format