From d3bbd43af75c3aaf0949d89142e53c60689aaf3e Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Tue, 21 Jan 2025 13:00:26 -0700 Subject: [PATCH 01/10] Create pipeline --- .github/workflows/run_tests.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/run_tests.yml diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml new file mode 100644 index 0000000..385948c --- /dev/null +++ b/.github/workflows/run_tests.yml @@ -0,0 +1,27 @@ +name: Python package + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3.10", "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: Test with pyment + run: | + coverage run --source pyment -m pytest -s tests + - name: Generate Coverage Report + run: | + coverage report From 7203d708102de3afb9a30e132fbb4368cd8c68be Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Tue, 21 Jan 2025 13:05:49 -0700 Subject: [PATCH 02/10] Create pipeline --- .github/workflows/run_tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 385948c..03989bf 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -19,6 +19,10 @@ jobs: # 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 coverage - name: Test with pyment run: | coverage run --source pyment -m pytest -s tests From 2b5afc61587793253282357bdbcca1efd9839719 Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Tue, 21 Jan 2025 13:07:02 -0700 Subject: [PATCH 03/10] Create pipeline --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 03989bf..5ba4c00 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install coverage + pip install pytest coverage - name: Test with pyment run: | coverage run --source pyment -m pytest -s tests From 12959fc88a1740912e6973b3426f02ac57942b20 Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Tue, 21 Jan 2025 13:55:25 -0700 Subject: [PATCH 04/10] Fix unit tests --- tests/issue51.py | 2 +- tests/issue88.py.patch | 4 ++-- tests/test_app.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) 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..469dd17 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -48,7 +48,7 @@ def func(): Args: Returns: - ret type: smthg + ret type: smthg Raises: @@ -73,7 +73,7 @@ def func(): - :rtype: ret type + Returns: - + ret type: smthg + + ret type: smthg + + Raises: @@ -224,7 +224,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 ) From 7d16d7d968e01aa77c21c5e4bc8398b99f83dc84 Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 09:24:13 -0700 Subject: [PATCH 05/10] Raises is an optional section of Google docstrings. Parenthesis around one item and no comma is not a tuple. --- pyment/docstring.py | 2 +- tests/test_app.py | 6 +----- tests/test_pyment_cases.py | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) 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/test_app.py b/tests/test_app.py index 469dd17..fb694e5 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -50,8 +50,6 @@ def func(): Returns: ret type: smthg - Raises: - """ pass ''') @@ -64,7 +62,7 @@ def func(): --- a/- +++ b/- - @@ -3,9 +3,12 @@ + @@ -3,9 +3,10 @@ def func(): """First line @@ -74,8 +72,6 @@ def func(): - :rtype: ret type + Returns: + ret type: smthg - + - + Raises: """ 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 From 90aa3bc126d4310a6a06f1d63471ac979a3527ab Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 11:51:10 -0700 Subject: [PATCH 06/10] Update Readme badge --- .github/workflows/run_tests.yml | 2 +- README.rst | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 5ba4c00..375d91f 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -1,4 +1,4 @@ -name: Python package +name: unit tests on: [push] diff --git a/README.rst b/README.rst index 94f1a02..c1b7c15 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 From f6641c83efb5da85c5c994a017e3dad8786c1c1e Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 12:07:13 -0700 Subject: [PATCH 07/10] Update Readme badge --- .github/workflows/run_tests.yml | 2 +- README.rst | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 375d91f..b581e6a 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["pypy3.10", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/README.rst b/README.rst index c1b7c15..f651dec 100644 --- a/README.rst +++ b/README.rst @@ -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 | From 22341f3f317347f676c809c250f56c195dbe7aaf Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 12:15:12 -0700 Subject: [PATCH 08/10] Update Readme badge --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index b581e6a..b2da329 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["pypy3.10", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["pypy3.10", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 From e6201705f78bc65b923c5475c42f608b08c721dd Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 12:45:49 -0700 Subject: [PATCH 09/10] Update Readme badge --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index f651dec..804adc6 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,8 @@ Linux: |github| Windows: |appveyor| -.. |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 +.. |github| image:: actions/workflows/run_tests.yml/badge.svg + :target: actions/workflows/run_tests.yml/badge.svg :alt: Linux tests (Github Actions) .. |appveyor| image:: https://ci.appveyor.com/api/projects/status/f9d4jps5fkf4m42h?svg=true From 321085852c1b5738c1c36d9439470a9db029ae84 Mon Sep 17 00:00:00 2001 From: Dawn Howe Date: Fri, 24 Jan 2025 13:13:30 -0700 Subject: [PATCH 10/10] Update Readme badge --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 804adc6..f651dec 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,8 @@ Linux: |github| Windows: |appveyor| -.. |github| image:: actions/workflows/run_tests.yml/badge.svg - :target: actions/workflows/run_tests.yml/badge.svg +.. |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