From 66f3734afaa23c5118f0d8294e49d93ef542628f Mon Sep 17 00:00:00 2001 From: Ashley Whetter Date: Sun, 4 Apr 2021 18:50:39 -0700 Subject: [PATCH] Start testing in Github Actions --- .github/workflows/main.yml | 34 +++++++++++++++++++++++++ .travis.yml | 26 ------------------- CHANGELOG.rst | 1 - README.rst | 10 +++----- appveyor.yml | 13 ---------- autoapi/mappers/python/astroid_utils.py | 11 ++++---- prospector.yml | 24 ----------------- setup.py | 2 ++ tox.ini | 18 ++----------- 9 files changed, 47 insertions(+), 92 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 prospector.yml create mode 100644 setup.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d4ae367 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,34 @@ +name: tests + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + platform: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install tox + - name: Run tests + run: tox -e py + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install tox + - name: Lint + run: tox -e formatting,lint diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dc20d87..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -os: linux -dist: xenial -language: python -install: - - pip install tox-travis -script: - - tox -python: - - 3.6 - - 3.7 - - 3.8 - - 3.9 -jobs: - include: - - python: 3.9 - env: TOXENV=docs - - python: 3.9 - env: TOXENV=lint - - python: 3.9 - env: TOXENV=formatting -notifications: - slack: - rooms: - - readthedocs:y3hjODOi7EIz1JAbD1Zb41sz#random - on_success: change - on_failure: always diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a8280d6..cd9047b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,7 +10,6 @@ Features ^^^^^^^^ * Expandable value for multi-line string attributes. -* Added support for Sphinx 3.5. * `#265 ` Can resolve the qualified paths of parameters to generics. diff --git a/README.rst b/README.rst index 6a50e3d..e618094 100644 --- a/README.rst +++ b/README.rst @@ -5,13 +5,9 @@ Sphinx AutoAPI :target: https://sphinx-autoapi.readthedocs.org :alt: Documentation -.. image:: https://travis-ci.org/readthedocs/sphinx-autoapi.svg?branch=master - :target: https://travis-ci.org/readthedocs/sphinx-autoapi - :alt: Travis Build Status - -.. image:: https://ci.appveyor.com/api/projects/status/5nd33gp2eq7411t1?svg=true - :target: https://ci.appveyor.com/project/ericholscher/sphinx-autoapi - :alt: Appveyor Build Status +.. image:: https://github.com/readthedocs/sphinx-autoapi/actions/workflows/main.yml/badge.svg?branch=master + :target: https://github.com/readthedocs/sphinx-autoapi/actions/workflows/main.yml?query=branch%3Amaster + :alt: Github Build Status .. image:: https://img.shields.io/pypi/v/sphinx-autoapi.svg :target: https://pypi.org/project/sphinx-autoapi/ diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 28bf795..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,13 +0,0 @@ -build: false -environment: - matrix: - - PYTHON: "C:/Python37" -install: - - ps: "[Net.ServicePointManager]::SecurityProtocol = 'Ssl3, Tls, Tls11, Tls12'" - - ps: "Start-FileDownload 'https://bootstrap.pypa.io/get-pip.py' -FileName 'C:/get-pip.py'" - - "%PYTHON%/python.exe C:/get-pip.py" - - "%PYTHON%/Scripts/pip.exe --version" - - "%PYTHON%/Scripts/pip.exe install tox" -test_script: - - "git clone https://github.com/aspnet/Identity %APPVEYOR_BUILD_FOLDER%/tests/dotnetexample/example/Identity" - - "%PYTHON%/Scripts/tox.exe -e py37" diff --git a/autoapi/mappers/python/astroid_utils.py b/autoapi/mappers/python/astroid_utils.py index 944cb12..06b7e6e 100644 --- a/autoapi/mappers/python/astroid_utils.py +++ b/autoapi/mappers/python/astroid_utils.py @@ -405,12 +405,13 @@ def _resolve_annotation(annotation): resolved = resolve_qualname(annotation, annotation.as_string()) elif isinstance(annotation, astroid.Subscript): value = _resolve_annotation(annotation.value) - if isinstance(annotation.slice, astroid.Tuple): - slice_ = ", ".join( - _resolve_annotation(elt) for elt in annotation.slice.elts - ) + slice_node = annotation.slice + if isinstance(slice_node, astroid.Index): + slice_node = slice_node.value + if isinstance(slice_node, astroid.Tuple): + slice_ = ", ".join(_resolve_annotation(elt) for elt in slice_node.elts) else: - slice_ = _resolve_annotation(annotation.slice) + slice_ = _resolve_annotation(slice_node) resolved = f"{value}[{slice_}]" elif isinstance(annotation, astroid.Tuple): resolved = ( diff --git a/prospector.yml b/prospector.yml deleted file mode 100644 index 758a6b3..0000000 --- a/prospector.yml +++ /dev/null @@ -1,24 +0,0 @@ -strictness: low - -test-warnings: false -doc-warnings: true - -ignore-paths: - - docs - - tests - -pep8: - run: false - -pylint: - max-line-length: 100 - disable: - - interface-not-implemented - # We still support Python 2 so we have to inherit from object - - useless-object-inheritance - -mccabe: - run: false - -pep257: - run: false diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8bf1ba9 --- /dev/null +++ b/setup.py @@ -0,0 +1,2 @@ +from setuptools import setup +setup() diff --git a/tox.ini b/tox.ini index fc62633..1fb0018 100644 --- a/tox.ini +++ b/tox.ini @@ -1,32 +1,18 @@ [tox] isolated_build = true envlist = - py{36,37,38,39}-sphinx{30,31,32,33,34,35} + # Keep this in sync with .github/workflows/main.yml + py{36,37,38,39} formatting lint docs -[travis] -python = - 3.6: py36 - 3.7: py37 - 3.8: py38 - 3.9: py39 - [testenv] -setenv = - LANG=C extras = dotnet go deps = pytest - sphinx30: Sphinx<3.1 - sphinx31: Sphinx<3.2 - sphinx32: Sphinx<3.3 - sphinx33: Sphinx<3.4 - sphinx34: Sphinx<3.5 - sphinx35: Sphinx<3.6 commands = pytest {posargs}