From 242c63dc8bb22ee4aab769eafee129b293aeaf01 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 4 Nov 2020 22:07:28 +0900 Subject: [PATCH 1/3] Do testing at GitHub Actions --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++++++-- .travis.yml | 6 ------ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7acfef6d2..1750a764a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,38 @@ -name: CI on Windows +name: CI on: [push, pull_request] jobs: - build: + ubuntu: + runs-on: ubuntu-16.04 + strategy: + fail-fast: false + matrix: + name: [py36, py37] + include: + - name: py36 + python: 3.6 + docutils: du13 + - name: py37 + python: 3.7 + docutils: du14 + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Check Python version + run: python --version + - name: Install graphviz + run: sudo apt-get install graphviz + - name: Install dependencies + run: pip install -U tox + - name: Run Tox + run: tox -e ${{ matrix.docutils }} -- -vv + + windows: runs-on: windows-latest strategy: matrix: diff --git a/.travis.yml b/.travis.yml index 47a8e7c7a..8e971a356 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,6 @@ jobs: - python: '3.5' env: - TOXENV=du12 - - python: '3.6' - env: - - TOXENV=du13 - - python: '3.7' - env: - - TOXENV=du14 - python: '3.8' env: - TOXENV=du15 From 218de39462798c8e102ff375b8ee9fb336537041 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 4 Nov 2020 23:19:25 +0900 Subject: [PATCH 2/3] Fix testcases for singledispatch are sometimes failed They are sometimes failed with python3.5 because the order of singledispatch functions is not stable on python 3.5. This uses comparision via "in" keyword to check the signature of singledispatch functions stably. --- tests/test_ext_autodoc.py | 33 ++++++++++++++++---------- tests/test_ext_autodoc_autofunction.py | 29 ++++++++++++++-------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/tests/test_ext_autodoc.py b/tests/test_ext_autodoc.py index c0676f23f..703cc13f6 100644 --- a/tests/test_ext_autodoc.py +++ b/tests/test_ext_autodoc.py @@ -1832,19 +1832,26 @@ def test_autodoc_for_egged_code(app): def test_singledispatch(app): options = {"members": None} actual = do_autodoc(app, 'module', 'target.singledispatch', options) - assert list(actual) == [ - '', - '.. py:module:: target.singledispatch', - '', - '', - '.. py:function:: func(arg, kwarg=None)', - ' func(arg: int, kwarg=None)', - ' func(arg: str, kwarg=None)', - ' :module: target.singledispatch', - '', - ' A function for general use.', - '', - ] + if sys.version_info < (3, 6): + # check the result via "in" because the order of singledispatch signatures is + # usually changed (because dict is not OrderedDict yet!) + assert '.. py:function:: func(arg, kwarg=None)' in actual + assert ' func(arg: int, kwarg=None)' in actual + assert ' func(arg: str, kwarg=None)' in actual + else: + assert list(actual) == [ + '', + '.. py:module:: target.singledispatch', + '', + '', + '.. py:function:: func(arg, kwarg=None)', + ' func(arg: int, kwarg=None)', + ' func(arg: str, kwarg=None)', + ' :module: target.singledispatch', + '', + ' A function for general use.', + '', + ] @pytest.mark.skipif(sys.version_info < (3, 8), diff --git a/tests/test_ext_autodoc_autofunction.py b/tests/test_ext_autodoc_autofunction.py index bb292bc6a..1f68c0319 100644 --- a/tests/test_ext_autodoc_autofunction.py +++ b/tests/test_ext_autodoc_autofunction.py @@ -9,6 +9,8 @@ :license: BSD, see LICENSE for details. """ +import sys + import pytest from test_ext_autodoc import do_autodoc @@ -108,16 +110,23 @@ def test_decorated(app): def test_singledispatch(app): options = {} actual = do_autodoc(app, 'function', 'target.singledispatch.func', options) - assert list(actual) == [ - '', - '.. py:function:: func(arg, kwarg=None)', - ' func(arg: int, kwarg=None)', - ' func(arg: str, kwarg=None)', - ' :module: target.singledispatch', - '', - ' A function for general use.', - '', - ] + if sys.version_info < (3, 6): + # check the result via "in" because the order of singledispatch signatures is + # usually changed (because dict is not OrderedDict yet!) + assert '.. py:function:: func(arg, kwarg=None)' in actual + assert ' func(arg: int, kwarg=None)' in actual + assert ' func(arg: str, kwarg=None)' in actual + else: + assert list(actual) == [ + '', + '.. py:function:: func(arg, kwarg=None)', + ' func(arg: int, kwarg=None)', + ' func(arg: str, kwarg=None)', + ' :module: target.singledispatch', + '', + ' A function for general use.', + '', + ] @pytest.mark.sphinx('html', testroot='ext-autodoc') From 4478f00c4cc2f813d8b62148813bf0dcc734c7e1 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 4 Nov 2020 23:21:52 +0900 Subject: [PATCH 3/3] Do testing with python3.5 at GitHub Actions --- .github/workflows/main.yml | 5 ++++- .travis.yml | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1750a764a..a85e3c8fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,8 +8,11 @@ jobs: strategy: fail-fast: false matrix: - name: [py36, py37] + name: [py35, py36, py37] include: + - name: py35 + python: 3.5 + docutils: du12 - name: py36 python: 3.6 docutils: du13 diff --git a/.travis.yml b/.travis.yml index 8e971a356..4123ba6b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,6 @@ env: jobs: include: - - python: '3.5' - env: - - TOXENV=du12 - python: '3.8' env: - TOXENV=du15