diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 58a142c..928aa5d 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.3.0 +current_version = 0.4.1 commit = True tag = True @@ -18,3 +18,5 @@ search = version = "{current_version}" replace = version = "{new_version}" [bumpversion:file:.github/workflows/conda_ci.yml] +search = ={current_version}=py_1 +replace = ={new_version}=py_1 diff --git a/.dependabot/config.yml b/.dependabot/config.yml deleted file mode 100644 index 4584924..0000000 --- a/.dependabot/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -# This file is managed by 'repo_helper'. Don't edit it directly. ---- -version: 1 -update_configs: -- package_manager: python - directory: / - update_schedule: weekly - default_reviewers: - - domdfcoding diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e769ad3..454225a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,5 +6,6 @@ updates: directory: / schedule: interval: weekly + open-pull-requests-limit: 0 reviewers: - domdfcoding diff --git a/.github/stale.yml b/.github/stale.yml index e5625b7..bb7fa62 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -7,7 +7,7 @@ daysUntilStale: 180 # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. # Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 180 +daysUntilClose: false # Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) onlyLabels: [] @@ -31,10 +31,10 @@ exemptAssignees: false staleLabel: stale # Comment to post when marking as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. +markComment: false +# This issue has been automatically marked as stale because it has not had +# recent activity. It will be closed if no further activity occurs. Thank you +# for your contributions. # Comment to post when removing the stale label. # unmarkComment: > diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index 4b057f6..15edb67 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -12,25 +12,28 @@ permissions: jobs: tests: name: "Conda" - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 defaults: run: shell: bash -l {0} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: - python-version: "3.8" + python-version: "3.11" - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v2.1.1 with: activate-environment: env - conda-build-version: 3.21.0 + conda-build-version: 3.28.4 + miniconda-version: py311_24.1.2-0 + python-version: "3.11" + miniforge-variant: Mambaforge - name: Install dependencies 🔧 run: | @@ -55,7 +58,7 @@ jobs: - name: "Install package" run: | - $CONDA/bin/conda install -c file://$(pwd)/conda-bld sphinx-autofixture=0.3.0=py_1 -y || exit 1 + $CONDA/bin/conda install -c file://$(pwd)/conda-bld sphinx-autofixture=0.4.1=py_1 -y || exit 1 - name: "Run Tests" run: | diff --git a/.github/workflows/docs_test_action.yml b/.github/workflows/docs_test_action.yml index d258e8d..331606e 100644 --- a/.github/workflows/docs_test_action.yml +++ b/.github/workflows/docs_test_action.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 84e9436..5e67c5c 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -16,11 +16,11 @@ permissions: jobs: Run: name: "Flake8" - runs-on: "ubuntu-18.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 @@ -33,9 +33,9 @@ jobs: - name: Setup Python 🐍 if: steps.changes.outputs.code == 'true' - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: - python-version: "3.6" + python-version: "3.9" - name: Install dependencies 🔧 if: steps.changes.outputs.code == 'true' @@ -43,7 +43,7 @@ jobs: python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install tox + python -m pip install tox~=3.0 - name: "Run Flake8" if: steps.changes.outputs.code == 'true' diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 5a7324b..4c22a52 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -20,12 +20,12 @@ jobs: strategy: matrix: - os: ['ubuntu-20.04', 'windows-2019'] + os: ['ubuntu-22.04', 'windows-2022'] fail-fast: false steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files uses: dorny/paths-filter@v2 @@ -38,16 +38,16 @@ jobs: - name: Setup Python 🐍 if: steps.changes.outputs.code == 'true' - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: - python-version: "3.6" + python-version: "3.9" - name: Install dependencies 🔧 run: | python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 - name: "Run mypy" if: steps.changes.outputs.code == 'true' diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 5557608..21af2ba 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -18,27 +18,30 @@ permissions: jobs: tests: - name: "windows-2019 / Python ${{ matrix.config.python-version }}" - runs-on: "windows-2019" + name: "windows-2022 / Python ${{ matrix.config.python-version }}" + runs-on: "windows-2022" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: config: - - {python-version: "3.6", testenvs: "py36-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-dev-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} - - {python-version: "pypy-3.6", testenvs: "pypy36-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} + - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},py37-pytest7.4,build", experimental: False} + - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},py38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},py39-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},py310-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py311-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py312-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py313-pytest{8.3,latest},build", experimental: False} + - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},pypy37-pytest7.4,build", experimental: False} + - {python-version: "pypy-3.8", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},pypy38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},pypy39-pytest{7.4,8.3,latest},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -53,7 +56,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -63,15 +66,16 @@ jobs: python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 - name: "Run Tests for Python ${{ matrix.config.python-version }}" if: steps.setup-python.outcome == 'success' run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index 5383e4a..2ef4c9f 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -19,27 +19,30 @@ permissions: jobs: tests: - name: "ubuntu-20.04 / Python ${{ matrix.config.python-version }}" - runs-on: "ubuntu-20.04" + name: "ubuntu-22.04 / Python ${{ matrix.config.python-version }}" + runs-on: "ubuntu-22.04" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,pypy-3.6,pypy-3.7' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: config: - - {python-version: "3.6", testenvs: "py36-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-dev-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} - - {python-version: "pypy-3.6", testenvs: "pypy36-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} + - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},py37-pytest7.4,build", experimental: False} + - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},py38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},py39-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},py310-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py311-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py312-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py313-pytest{8.3,latest},build", experimental: False} + - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},pypy37-pytest7.4,build", experimental: False} + - {python-version: "pypy-3.8", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},pypy38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "pypy-3.9", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},pypy39-pytest{7.4,8.3,latest},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -54,7 +57,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -64,7 +67,7 @@ jobs: python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 python -m pip install --upgrade coverage_pyver_pragma - name: "Run Tests for Python ${{ matrix.config.python-version }}" @@ -72,22 +75,23 @@ jobs: run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true Coverage: needs: tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: python-version: 3.8 @@ -97,7 +101,7 @@ jobs: python -m pip install --upgrade "coveralls>=3.0.0" coverage_pyver_pragma - name: "Download Coverage 🪂" - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: path: coverage @@ -115,10 +119,11 @@ jobs: - name: "Upload Combined Coverage Artefact 🚀" if: ${{ steps.show.outcome != 'failure' }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: "combined-coverage" path: .coverage + include-hidden-files: true - name: "Upload Combined Coverage to Coveralls" if: ${{ steps.show.outcome != 'failure' }} @@ -130,14 +135,14 @@ jobs: Deploy: needs: tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" if: startsWith(github.ref, 'refs/tags/') - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" if: startsWith(github.ref, 'refs/tags/') with: python-version: 3.8 @@ -146,7 +151,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox + python -m pip install --upgrade tox~=3.0 - name: Build distributions 📦 if: startsWith(github.ref, 'refs/tags/') @@ -174,22 +179,25 @@ jobs: Conda: needs: deploy - runs-on: "ubuntu-18.04" + runs-on: ubuntu-22.04 if: startsWith(github.ref, 'refs/tags/') || (startsWith(github.event.head_commit.message, 'Bump version') != true) steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Setup Python 🐍 - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: - python-version: 3.8 + python-version: 3.11 - name: Setup Conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v2.1.1 with: activate-environment: env - conda-build-version: 3.21.0 + conda-build-version: 3.28.4 + miniconda-version: py311_24.1.2-0 + python-version: "3.11" + miniforge-variant: Mambaforge - name: Install dependencies 🔧 run: | @@ -201,6 +209,7 @@ jobs: $CONDA/bin/conda config --set always_yes yes --set changeps1 no $CONDA/bin/conda update -n base conda $CONDA/bin/conda info -a + $CONDA/bin/conda install conda-forge::py-lief=0.14.1 $CONDA/bin/conda config --add channels conda-forge $CONDA/bin/conda config --add channels domdfcoding diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index e7e6fc3..3c04907 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -18,26 +18,30 @@ permissions: jobs: tests: - name: "macos-latest / Python ${{ matrix.config.python-version }}" - runs-on: "macos-latest" + name: "macos-${{ matrix.config.os-ver }} / Python ${{ matrix.config.python-version }}" + runs-on: "macos-${{ matrix.config.os-ver }}" continue-on-error: ${{ matrix.config.experimental }} env: - USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10,pypy-3.7' + USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' strategy: fail-fast: False matrix: config: - - {python-version: "3.6", testenvs: "py36-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-dev-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} - - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{3.2,3.3,3.4,3.5},build", experimental: True} + - {python-version: "3.7", os-ver: "13", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},py37-pytest7.4,build", experimental: False} + - {python-version: "3.8", os-ver: "14", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},py38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "3.9", os-ver: "14", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},py39-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.10", os-ver: "14", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},py310-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.11", os-ver: "14", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py311-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.12", os-ver: "14", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py312-pytest{7.4,8.3,latest},build", experimental: False} + - {python-version: "3.13", os-ver: "14", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},py313-pytest{8.3,latest},build", experimental: False} + - {python-version: "pypy-3.7", os-ver: "13", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},pypy37-pytest7.4,build", experimental: False} + - {python-version: "pypy-3.8", os-ver: "14", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},pypy38-pytest{7.4,8.3},build", experimental: False} + - {python-version: "pypy-3.9", os-ver: "14", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},pypy39-pytest{7.4,8.3,latest},build", experimental: True} steps: - name: Checkout 🛎️ - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: Check for changed files if: startsWith(github.ref, 'refs/tags/') != true @@ -52,7 +56,7 @@ jobs: - name: Setup Python 🐍 id: setup-python if: ${{ steps.changes.outputs.code == 'true' || steps.changes.outcome == 'skipped' }} - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v5" with: python-version: "${{ matrix.config.python-version }}" @@ -62,15 +66,16 @@ jobs: python -VV python -m site python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade tox virtualenv + python -m pip install --upgrade tox~=3.0 virtualenv!=20.16.0 - name: "Run Tests for Python ${{ matrix.config.python-version }}" if: steps.setup-python.outcome == 'success' run: python -m tox -e "${{ matrix.config.testenvs }}" -s false - name: "Upload Coverage 🚀" - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 if: ${{ always() && steps.setup-python.outcome == 'success' }} with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8266b14..3f31ad0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,9 +3,12 @@ exclude: ^$ +ci: + autoupdate_schedule: quarterly + repos: - repo: https://github.com/repo-helper/pyproject-parser - rev: v0.4.2 + rev: v0.13.0 hooks: - id: reformat-pyproject @@ -30,7 +33,7 @@ repos: - id: end-of-file-fixer - repo: https://github.com/domdfcoding/pre-commit-hooks - rev: v0.3.0 + rev: v0.4.0 hooks: - id: requirements-txt-sorter args: @@ -39,19 +42,19 @@ repos: exclude: ^(doc-source/conf|__pkginfo__|setup|tests/.*)\.py$ - id: bind-requirements - - repo: https://github.com/domdfcoding/flake8-dunder-all - rev: v0.1.8 + - repo: https://github.com/python-formate/flake8-dunder-all + rev: v0.4.1 hooks: - id: ensure-dunder-all files: ^sphinx_autofixture/.*\.py$ - repo: https://github.com/domdfcoding/flake2lint - rev: v0.4.1 + rev: v0.4.3 hooks: - id: flake2lint - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-no-eval - id: rst-backticks @@ -67,24 +70,24 @@ repos: - --keep-runtime-typing - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.1.11 + rev: v1.5.1 hooks: - id: remove-crlf - id: forbid-crlf - repo: https://github.com/python-formate/snippet-fmt - rev: v0.1.4 + rev: v0.1.5 hooks: - id: snippet-fmt - repo: https://github.com/python-formate/formate - rev: v0.4.9 + rev: v0.8.0 hooks: - id: formate exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$ - - repo: https://github.com/domdfcoding/dep_checker - rev: v0.6.2 + - repo: https://github.com/python-coincidence/dep_checker + rev: v0.8.0 hooks: - id: dep_checker args: diff --git a/.readthedocs.yml b/.readthedocs.yml index 41d2e57..83fc025 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -9,9 +9,16 @@ formats: - pdf - htmlzip python: - version: 3.8 install: - requirements: requirements.txt - requirements: doc-source/requirements.txt - - method: pip - path: . +build: + os: ubuntu-22.04 + tools: + python: '3.9' + jobs: + post_create_environment: + - pip install . + post_install: + - pip install sphinxcontrib-applehelp==1.0.4 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.1 + sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 diff --git a/README.rst b/README.rst index 6d7c149..0138f80 100644 --- a/README.rst +++ b/README.rst @@ -63,8 +63,8 @@ and `the documentation for coincidence`_ for an example with the ReadTheDocs the :target: https://github.com/sphinx-toolbox/sphinx-autofixture/actions?query=workflow%3A%22mypy%22 :alt: mypy status -.. |requires| image:: https://dependency-dash.herokuapp.com/github/sphinx-toolbox/sphinx-autofixture/badge.svg - :target: https://dependency-dash.herokuapp.com/github/sphinx-toolbox/sphinx-autofixture/ +.. |requires| image:: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/sphinx-autofixture/badge.svg + :target: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/sphinx-autofixture/ :alt: Requirements Status .. |coveralls| image:: https://img.shields.io/coveralls/github/sphinx-toolbox/sphinx-autofixture/master?logo=coveralls @@ -106,7 +106,7 @@ and `the documentation for coincidence`_ for an example with the ReadTheDocs the .. |language| image:: https://img.shields.io/github/languages/top/sphinx-toolbox/sphinx-autofixture :alt: GitHub top language -.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/sphinx-autofixture/v0.3.0 +.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/sphinx-autofixture/v0.4.1 :target: https://github.com/sphinx-toolbox/sphinx-autofixture/pulse :alt: GitHub commits since tagged version @@ -114,7 +114,7 @@ and `the documentation for coincidence`_ for an example with the ReadTheDocs the :target: https://github.com/sphinx-toolbox/sphinx-autofixture/commit/master :alt: GitHub last commit -.. |maintained| image:: https://img.shields.io/maintenance/yes/2022 +.. |maintained| image:: https://img.shields.io/maintenance/yes/2025 :alt: Maintenance .. |pypi-downloads| image:: https://img.shields.io/pypi/dm/sphinx-autofixture diff --git a/doc-source/conf.py b/doc-source/conf.py index 60c5cb4..bc7c1a8 100644 --- a/doc-source/conf.py +++ b/doc-source/conf.py @@ -27,7 +27,8 @@ slug = re.sub(r'\W+', '-', project.lower()) release = version = config.version -todo_include_todos = bool(os.environ.get("SHOW_TODOS", 0)) +sphinx_builder = os.environ.get("SPHINX_BUILDER", "html").lower() +todo_include_todos = int(os.environ.get("SHOW_TODOS", 0)) and sphinx_builder != "latex" intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), @@ -70,8 +71,29 @@ } +# Fix for pathlib issue with sphinxemoji on Python 3.9 and Sphinx 4.x +def copy_asset_files(app, exc): + # 3rd party + from domdf_python_tools.compat import importlib_resources + from sphinx.util.fileutil import copy_asset + + if exc: + return + + asset_files = ["twemoji.js", "twemoji.css"] + for path in asset_files: + path_str = os.fspath(importlib_resources.files("sphinxemoji") / path) + copy_asset(path_str, os.path.join(app.outdir, "_static")) + + def setup(app): # 3rd party from sphinx_toolbox.latex import better_header_layout + from sphinxemoji import sphinxemoji app.connect("config-inited", lambda app, config: better_header_layout(config)) + app.connect("build-finished", copy_asset_files) + app.add_js_file("https://unpkg.com/twemoji@latest/dist/twemoji.min.js") + app.add_js_file("twemoji.js") + app.add_css_file("twemoji.css") + app.add_transform(sphinxemoji.EmojiSubstitutions) diff --git a/doc-source/index.rst b/doc-source/index.rst index 88fee8b..90d5ae1 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -60,8 +60,8 @@ sphinx-autofixture :workflow: mypy :alt: mypy status - .. |requires| image:: https://dependency-dash.herokuapp.com/github/sphinx-toolbox/sphinx-autofixture/badge.svg - :target: https://dependency-dash.herokuapp.com/github/sphinx-toolbox/sphinx-autofixture/ + .. |requires| image:: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/sphinx-autofixture/badge.svg + :target: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/sphinx-autofixture/ :alt: Requirements Status .. |coveralls| coveralls-shield:: @@ -107,14 +107,14 @@ sphinx-autofixture :alt: GitHub top language .. |commits-since| github-shield:: - :commits-since: v0.3.0 + :commits-since: v0.4.1 :alt: GitHub commits since tagged version .. |commits-latest| github-shield:: :last-commit: :alt: GitHub last commit - .. |maintained| maintained-shield:: 2022 + .. |maintained| maintained-shield:: 2025 :alt: Maintenance .. |pypi-downloads| pypi-shield:: diff --git a/doc-source/requirements.txt b/doc-source/requirements.txt index 83fa3e2..4971871 100644 --- a/doc-source/requirements.txt +++ b/doc-source/requirements.txt @@ -1,17 +1,22 @@ -default-values>=0.5.0 +coincidence>=0.6.5 +default-values>=0.6.0 domdf-python-tools[testing]>=1.5.0 -extras-require>=0.2.0 -furo>=2020.11.19b18 -html-section>=0.1.0 -seed-intersphinx-mapping>=0.3.1 +extras-require>=0.5.0 +furo==2021.06.18b36 +html-section>=0.3.0 +seed-intersphinx-mapping>=1.2.2 sphinx-copybutton>=0.2.12 -sphinx-debuginfo>=0.1.0 -sphinx-licenseinfo>=0.1.1 -sphinx-notfound-page>=0.5 -sphinx-prompt>=1.1.0 +sphinx-debuginfo>=0.2.2 +sphinx-licenseinfo>=0.3.1 +sphinx-notfound-page>=0.7.1 sphinx-pyproject>=0.1.0 -sphinx-tabs>=1.1.13 -sphinx-toolbox>=2.13.0 +sphinx-toolbox>=3.5.0 +sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-htmlhelp==2.0.1 sphinxcontrib-httpdomain>=1.7.0 +sphinxcontrib-jsmath==1.0.1 +sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-serializinghtml==1.1.5 sphinxemoji>=0.1.6 -toctree-plus>=0.5.0 +toctree-plus>=0.6.1 diff --git a/formate.toml b/formate.toml index 762e00d..25f5c52 100644 --- a/formate.toml +++ b/formate.toml @@ -6,21 +6,17 @@ noqa-reformat = 60 ellipsis-reformat = 70 squish_stubs = 80 -[config] -indent = "\t" -line_length = 115 - [hooks.yapf] priority = 30 -[hooks.isort] -priority = 50 - [hooks.yapf.kwargs] yapf_style = ".style.yapf" +[hooks.isort] +priority = 50 + [hooks.isort.kwargs] -indent = "\t\t" +indent = " " multi_line_output = 8 import_heading_stdlib = "stdlib" import_heading_thirdparty = "3rd party" @@ -35,6 +31,7 @@ known_third_party = [ "coincidence", "coverage", "coverage_pyver_pragma", + "defusedxml", "domdf_python_tools", "github", "importlib_metadata", @@ -47,5 +44,9 @@ known_third_party = [ "sphinx_jinja2_compat", "sphinx_toolbox", ] -known_first_party = "sphinx_autofixture" +known_first_party = [ "sphinx_autofixture",] +line_length = 115 + +[config] +indent = " " line_length = 115 diff --git a/justfile b/justfile new file mode 100644 index 0000000..e8ed871 --- /dev/null +++ b/justfile @@ -0,0 +1,22 @@ +default: lint + +pdf-docs: latex-docs + make -C doc-source/build/latex/ + +latex-docs: + SPHINX_BUILDER=latex tox -e docs + +unused-imports: + tox -e lint -- --select F401 + +incomplete-defs: + tox -e lint -- --select MAN + +vdiff: + git diff $(repo-helper show version -q)..HEAD + +bare-ignore: + greppy '# type:? *ignore(?!\[|\w)' -s + +lint: unused-imports incomplete-defs bare-ignore + tox -n qa diff --git a/pyproject.toml b/pyproject.toml index e8dc9ea..14bdb4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,20 +4,19 @@ build-backend = "whey" [project] name = "sphinx-autofixture" -version = "0.3.0" +version = "0.4.1" description = "Sphinx autodocumenter for pytest fixtures." readme = "README.rst" keywords = [ "documentation", "pytest", "sphinx", "sphinx-extension",] dynamic = [ "requires-python", "classifiers", "dependencies",] +[project.license] +file = "LICENSE" + [[project.authors]] name = "Dominic Davis-Foster" email = "dominic@davis-foster.co.uk" - -[project.license] -file = "LICENSE" - [project.urls] Homepage = "https://github.com/sphinx-toolbox/sphinx-autofixture" "Issue Tracker" = "https://github.com/sphinx-toolbox/sphinx-autofixture/issues" @@ -35,7 +34,7 @@ base-classifiers = [ "Topic :: Software Development :: Documentation", "Typing :: Typed", ] -python-versions = [ "3.6", "3.7", "3.8", "3.9",] +python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13",] python-implementations = [ "CPython", "PyPy",] platforms = [ "Windows", "macOS", "Linux",] license-key = "MIT" @@ -59,17 +58,16 @@ extensions = [ "sphinx_toolbox.more_autosummary", "sphinx_toolbox.documentation_summary", "sphinx_toolbox.tweaks.param_dash", + "sphinxcontrib.toctree_plus", "sphinx_toolbox.tweaks.latex_layout", "sphinx_toolbox.tweaks.latex_toc", "sphinx.ext.intersphinx", "sphinx.ext.mathjax", "sphinxcontrib.extras_require", "sphinx.ext.todo", - "sphinxemoji.sphinxemoji", "notfound.extension", "sphinx_copybutton", "sphinxcontrib.default_values", - "sphinxcontrib.toctree_plus", "sphinx_debuginfo", "sphinx_licenseinfo", "seed_intersphinx_mapping", @@ -77,7 +75,6 @@ extensions = [ "sphinx_autofixture", "html_section", ] -sphinxemoji_style = "twemoji" gitstamp_fmt = "%d %b %Y" templates_path = [ "_templates",] html_static_path = [ "_static",] @@ -127,7 +124,7 @@ autodoc_exclude_members = [ ] [tool.mypy] -python_version = "3.6" +python_version = "3.9" namespace_packages = true check_untyped_defs = true warn_unused_ignores = true @@ -137,6 +134,16 @@ show_error_codes = true [tool.snippet-fmt] directives = [ "code-block",] +[tool.snippet-fmt.languages.python] +reformat = true + +[tool.snippet-fmt.languages.TOML] +reformat = true + +[tool.snippet-fmt.languages.ini] + +[tool.snippet-fmt.languages.json] + [tool.dep_checker] allowed_unused = [ "sphinx_jinja2_compat",] @@ -150,13 +157,3 @@ include = false [tool.dependency-dash."doc-source/requirements.txt"] order = 30 include = false - -[tool.snippet-fmt.languages.python] -reformat = true - -[tool.snippet-fmt.languages.TOML] -reformat = true - -[tool.snippet-fmt.languages.ini] - -[tool.snippet-fmt.languages.json] diff --git a/repo_helper.yml b/repo_helper.yml index 0ce46cd..f926df4 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -7,7 +7,7 @@ email: 'dominic@davis-foster.co.uk' username: "sphinx-toolbox" assignee: "domdfcoding" primary_conda_channel: 'domdfcoding' -version: '0.3.0' +version: '0.4.1' license: 'MIT' short_desc: 'Sphinx autodocumenter for pytest fixtures.' @@ -15,15 +15,142 @@ use_whey: true sphinx_html_theme: furo preserve_custom_theme: true min_coverage: 95 +mypy_version: 1.16 +python_deploy_version: 3.9 +# Versions to run tests for python_versions: - - 3.6 - - 3.7 - - 3.8 - - 3.9 - - 3.10-dev - - pypy36 - - pypy37 + '3.7': + matrix_exclude: + pytest: + - 8.3 + - latest + sphinx: + - 6.0 + - 6.1 + - 6.2 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - latest + '3.8': + matrix_exclude: + pytest: + - latest + sphinx: + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - latest + 3.9: + matrix_exclude: + sphinx: + - 8.0 + - 8.1 + - 8.2 + "3.10": + matrix_exclude: + sphinx: + - 8.2 + "3.11": + "3.12": + matrix_exclude: + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 4.3 + "3.13": + matrix_exclude: + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 4.3 + - 4.4 + - 4.5 + - 5.0 + - 5.1 + - 5.2 + - 5.3 + - 6.0 + - 6.1 + pytest: + - 7.4 + pypy37: + matrix_exclude: + pytest: + - 8.3 + - latest + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 6.0 + - 6.1 + - 6.2 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - latest + pypy38: + matrix_exclude: + pytest: + - latest + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + - 8.2 + - latest + pypy39: + matrix_exclude: + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 8.0 + - 8.1 + - 8.2 + - latest conda_channels: - conda-forge @@ -38,6 +165,31 @@ third_party_version_matrix: - 3.3 - 3.4 - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 4.3 + - 4.4 + - 4.5 + - 5.0 + - 5.1 + - 5.2 + - 5.3 + - 6.0 + - 6.1 + - 6.2 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - 7.4 + - 8.0 + - 8.1 + - 8.2 + pytest: + - 7.4 + - 8.3 + - latest keywords: - sphinx @@ -56,3 +208,7 @@ classifiers: exclude_files: - contributing + +tox_unmanaged: + - testenv + - fixups diff --git a/requirements.txt b/requirements.txt index fb948ed..bd467c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -domdf-python-tools>=1.5.0 -sphinx<3.6.0,>=3.0.3 +domdf-python-tools>=3.0.0 +sphinx>=3.0.3 sphinx-jinja2-compat>=0.1.2 diff --git a/sphinx_autofixture/__init__.py b/sphinx_autofixture/__init__.py index e470b53..507e693 100644 --- a/sphinx_autofixture/__init__.py +++ b/sphinx_autofixture/__init__.py @@ -45,11 +45,19 @@ __author__: str = "Dominic Davis-Foster" __copyright__: str = "2020 Dominic Davis-Foster" __license__: str = "MIT License" -__version__: str = "0.3.0" +__version__: str = "0.4.1" __email__: str = "dominic@davis-foster.co.uk" __all__ = ["FixtureDecoratorFinder", "FixtureDocumenter", "is_fixture", "setup"] +try: # pragma: no cover + # 3rd party + from _pytest.fixtures import FixtureFunctionDefinition +except ImportError: # pragma: no cover + + class FixtureFunctionDefinition: # type: ignore[no-redef] + pass + class FixtureDecoratorFinder(ast.NodeVisitor): """ @@ -160,8 +168,8 @@ def can_document_member( :param parent: The parent of the member. """ - if isinstance(member, FunctionType): - return is_fixture(member)[0] + if isinstance(member, (FunctionType, FixtureFunctionDefinition)): + return is_fixture(member)[0] # type: ignore[arg-type] else: # pragma: no cover return False diff --git a/tests/doc-test/test-root/conf.py b/tests/doc-test/test-root/conf.py index 36055e4..b2ccf4c 100644 --- a/tests/doc-test/test-root/conf.py +++ b/tests/doc-test/test-root/conf.py @@ -5,3 +5,4 @@ ] package_root = "dummy_package" +project = "Python" diff --git a/tests/doc-test/test-root/index.rst b/tests/doc-test/test-root/index.rst index c24ff15..9a97d52 100644 --- a/tests/doc-test/test-root/index.rst +++ b/tests/doc-test/test-root/index.rst @@ -10,10 +10,10 @@ sphinx-autofixture Demo :members: tmp_pathplus :noindex: :no-docstring: - :exclude-members: __dict__ + :exclude-members: __dict__,__firstlineno__,__replace__,__static_attributes__ .. automodule:: tests.myproject :members: :undoc-members: :special-members: - :exclude-members: __dict__ + :exclude-members: __dict__,__firstlineno__,__replace__,__static_attributes__ diff --git a/tests/myproject.py b/tests/myproject.py index 9d917a4..d1ae879 100644 --- a/tests/myproject.py +++ b/tests/myproject.py @@ -18,9 +18,9 @@ class A: __all__.append('A') -def foo(): +def foo() -> Callable: - def bar(): + def bar(): # noqa: MAN002 """ A locally defined function. """ @@ -32,7 +32,7 @@ def bar(): # fizbuzz = foo() -def create_fizbuzz(): +def create_fizbuzz(): # noqa: MAN002 # Based on the dataclass module from CPython locals = {"BUILTINS": builtins} # noqa: A001 # pylint: disable=redefined-builtin local_vars = ", ".join(locals.keys()) diff --git a/tests/requirements.txt b/tests/requirements.txt index d1d77c7..830698f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,9 +1,10 @@ coincidence>=0.2.0 coverage>=5.1 coverage-pyver-pragma>=0.2.1 +defusedxml>=0.7.1 importlib-metadata>=3.6.0 pytest>=6.0.0 pytest-cov>=2.8.1 pytest-randomly>=3.7.0 pytest-timeout>=1.4.2 -sphinx-toolbox[testing]>=2.13.0b1 +sphinx-toolbox[testing]>=4.0.0 diff --git a/tests/test_directive.py b/tests/test_directive.py index 587396a..79c44dd 100644 --- a/tests/test_directive.py +++ b/tests/test_directive.py @@ -1,17 +1,24 @@ # stdlib import os +import pathlib from pathlib import Path -from typing import Any, Iterator +from typing import Any, Iterator, Tuple, Union, cast, no_type_check # 3rd party import pytest -from bs4 import BeautifulSoup, element # type: ignore[import] +import sphinx +from bs4 import BeautifulSoup, NavigableString, PageElement, Tag, element from coincidence import max_version, min_version, not_pypy, only_pypy, only_version from domdf_python_tools.paths import PathPlus from sphinx.application import Sphinx -from sphinx.testing.path import path from sphinx_toolbox.testing import HTMLRegressionFixture +if sphinx.version_info >= (7, 2): + path = pathlib.Path +else: + # 3rd party + from sphinx.testing.path import path # type: ignore[assignment] + pytest_plugins = "sphinx.testing.fixtures" @@ -31,7 +38,7 @@ def content(app: Sphinx) -> Iterator[Sphinx]: @pytest.fixture() def page(content: Any, request: Any) -> Iterator[BeautifulSoup]: pagename = request.param - c = (content.outdir / pagename).read_text() + c = (content.outdir / pagename).read_text(encoding="UTF-8") yield BeautifulSoup(c, "html5lib") @@ -53,13 +60,6 @@ def original_datadir(request: Any) -> Path: not_pypy("Output differs on PyPy") ] ), - pytest.param( - "37", - marks=[ - only_version("3.7", reason="Output differs on 3.7"), - not_pypy("Output differs on PyPy") - ] - ), pytest.param( "36-pypy", marks=[ @@ -70,18 +70,19 @@ def original_datadir(request: Any) -> Path: pytest.param( "37-pypy", marks=[ - only_version("3.7", reason="Output differs on 3.7"), + min_version("3.7", reason="Output differs on 3.7"), only_pypy("Output differs on PyPy") ] ), pytest.param( - "38", + "37", marks=[ - min_version("3.8", reason="Output differs on 3.6-3.7"), - max_version("3.9.99", reason="Output differs on 3.10") + min_version("3.7", reason="Output differs on 3.6"), + max_version("3.9.99", reason="Output differs on 3.10"), + not_pypy("Output differs on PyPy"), ] ), - pytest.param("310", marks=only_version("3.10", reason="Output differs on 3.10")), + pytest.param("310", marks=min_version("3.10", reason="Output differs on 3.10")), ] ) def test_output( @@ -90,16 +91,35 @@ def test_output( version: str, ) -> None: - code: element.Tag + code: Union[PageElement, Tag, NavigableString] for code in page.find_all("code", attrs={"class": "sig-prename descclassname"}): - + assert isinstance(code, Tag) first_child = code.contents[0] if isinstance(first_child, element.Tag): code.contents = [first_child.contents[0]] for code in page.find_all("code", attrs={"class": "sig-name descname"}): + assert isinstance(code, Tag) first_child = code.contents[0] if isinstance(first_child, element.Tag): code.contents = [first_child.contents[0]] - html_regression.check(page, jinja2=True) + for div in page.find_all("script"): + assert isinstance(div, Tag) + if div.get("src"): + div["src"] = cast(str, div["src"]).split("?v=")[0] + print(div["src"]) + + html_regression.check(page, jinja2=True, jinja2_namespace={"alabaster_version": _get_alabaster_version()}) + + +@no_type_check +def _get_alabaster_version() -> Tuple[int, int, int]: + try: + # 3rd party + import alabaster._version as alabaster # type: ignore[import-untyped] + except ImportError: + # 3rd party + import alabaster # type: ignore[import-untyped] + + return tuple(map(int, alabaster.__version__.split('.'))) diff --git a/tests/test_directive_/test_output_310_index_html_.html b/tests/test_directive_/test_output_310_index_html_.html index 0ab82d0..7b39c2b 100644 --- a/tests/test_directive_/test_output_310_index_html_.html +++ b/tests/test_directive_/test_output_310_index_html_.html @@ -1,48 +1,69 @@ +{% macro span_pre(text, indent='', min_version=(3, 5)) -%} +{% if sphinx_version >= min_version %} +{{ indent }} {{ text }} +{{ indent }}{% else %}{{ text }}{% endif %} +{%- endmacro -%} +{% macro span_target (module, indent='', min_version=(7, 2)) -%} +{% if sphinx_version >= min_version %}
{% else %} +{{ indent }} +{{ indent }}
{% endif %} +{%- endmacro -%} +{% set permalink = ("Link" if sphinx_version >= (7, 2) else 'Permalink') -%} +{% set heading = ("heading" if sphinx_version >= (5, 0) else 'headline') -%} +{% set sig_prename_tag=("span" if sphinx_version >= (4, 0) else 'code') -%} +{% set sig_object_class=(' class="sig sig-object py"' if sphinx_version >= (4, 0) else '') -%} +{% set section = ("section", "section") if docutils_version >= (0, 17) else ('div class="section"', "div") -%} - += (7, 2) %} data-content_root="./"{% endif %}{% if sphinx_version >= (5, 0) %} lang="en"{% endif %}> - + {% if docutils_version[1] == 18 %}<meta content="Docutils 0.18.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 17 %}<meta content="Docutils 0.17.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 19 %}<meta content="Docutils 0.19: https://docutils.sourceforge.io/" name="generator"/> + {% elif docutils_version[1] >= 20 %}<meta content="width=device-width, initial-scale=1" name="viewport"/> + {% endif %}<title> sphinx-autofixture Demo — Python documentation - - + {% if sphinx_version >= (7, 2) %} + {% if sphinx_version < (6, 0) %} + {% if sphinx_version >= (5, 0) %} + {% endif %}{% endif %} - + {% if sphinx_version >= (5, 2) %} + {% endif %}{% if alabaster_version < (0, 7, 15) %} + {% endif %}
-
+ <{% if docutils_version >= (0, 17) %}section{% else %}div class="section"{% endif %} id="sphinx-autofixture-demo">

sphinx-autofixture Demo - +

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} + +
@@ -90,19 +111,16 @@

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} +

@@ -138,23 +156,18 @@

- - -
-
- {% if sphinx_version >= (3, 5) %} - - class - {% else %} - class{% endif %} + {{ span_target("tests.myproject", " ")}} + + + {{ span_pre("class", " ", (3, 5)) }} - - tests.myproject. - - - A - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("A", " ") }} + +
@@ -163,11 +176,11 @@

My Dataclass

-
- - __dataclass_fields__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_fields__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -176,7 +189,7 @@

{% else %} = {}{% endif %} - +

@@ -184,20 +197,20 @@

-
- - __dataclass_params__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_params__", " ") }} + {% set DataclassParams_end_args = ',match_args=True,kw_only=False,slots=False,weakref_slot=False' if python_version >= (3, 12) else '' %} + {% if (3, 5) <= sphinx_version < (4, 3) %} = - _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False) + _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False{{ DataclassParams_end_args }}) {% else %} - = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False){% endif %} + = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False{{ DataclassParams_end_args }}){% endif %} - +
@@ -205,25 +218,22 @@

-
- - __eq__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__eq__", " ") }} + ( - {% if sphinx_version >= (3, 5) %} - - other - {% else %} - other{% endif %} + + {{ span_pre("other", " ", (3, 5)) }} ) - +
@@ -234,11 +244,11 @@

-
- - __hash__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__hash__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -247,7 +257,7 @@

{% else %} = None{% endif %} - +

@@ -255,37 +265,47 @@

-
- - __init__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__init__", " ") }} + ( ) - {% if sphinx_version >= (3, 5) %} + {% if sphinx_version >= (4, 1) %} + + + → + + + + None + + + {% elif sphinx_version >= (3, 5) %} → None {% else %} → None{% endif %} - +
-
+
{% if sphinx_version < (4, 1) %}

Initialize self. See help(type(self)) for accurate signature. -

+

{% endif %}
-
- - __match_args__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__match_args__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -294,7 +314,7 @@

{% else %} = (){% endif %} - +

@@ -302,11 +322,11 @@

-
- - __module__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__module__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -315,7 +335,7 @@

{% else %} = 'tests.myproject'{% endif %} - +

@@ -323,17 +343,17 @@

-
- - __repr__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__repr__", " ") }} + ( ) - +
@@ -344,37 +364,37 @@

-
- - __weakref__ - - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__weakref__", " ") }} + +

- list of weak references to the object (if defined) + list of weak references to the object{% if python_version < (3, 11) %} (if defined){% endif %}

-
- - tests.myproject. - - - baz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("baz", " ") }} + ( ) - +
@@ -385,20 +405,20 @@

-
- - tests.myproject. - - - fizbuzz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("fizbuzz", " ") }} + ( ) - +
@@ -408,7 +428,9 @@

- + = (0, 17) %}section{% else %}div{% endif %}>{% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_directive_/test_output_36_index_html_.html b/tests/test_directive_/test_output_36_index_html_.html deleted file mode 100644 index 637364d..0000000 --- a/tests/test_directive_/test_output_36_index_html_.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - sphinx-autofixture Demo — Python documentation - - - - - - - - -
-
-
-
-
-

- sphinx-autofixture Demo - - ¶ - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - - - ¶ - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
-

- - - - coincidence.fixtures.tmp_pathplus - - - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
- - -
-
- - tests.myproject. - - - baz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
- - tests.myproject. - - - fizbuzz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
-
-
-
-
-
- - diff --git a/tests/test_directive_/test_output_36_pypy_index_html_.html b/tests/test_directive_/test_output_36_pypy_index_html_.html deleted file mode 100644 index 637364d..0000000 --- a/tests/test_directive_/test_output_36_pypy_index_html_.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - sphinx-autofixture Demo — Python documentation - - - - - - - - -
-
-
-
-
-

- sphinx-autofixture Demo - - ¶ - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - - - ¶ - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
-

- - - - coincidence.fixtures.tmp_pathplus - - - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
- - -
-
- - tests.myproject. - - - baz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
- - tests.myproject. - - - fizbuzz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
-
-
-
-
-
- - diff --git a/tests/test_directive_/test_output_37_index_html_.html b/tests/test_directive_/test_output_37_index_html_.html index 7b6cba3..bdfc0b2 100644 --- a/tests/test_directive_/test_output_37_index_html_.html +++ b/tests/test_directive_/test_output_37_index_html_.html @@ -1,48 +1,69 @@ +{% macro span_pre(text, indent='', min_version=(3, 5)) -%} +{% if sphinx_version >= min_version %} +{{ indent }} {{ text }} +{{ indent }}{% else %}{{ text }}{% endif %} +{%- endmacro -%} +{% macro span_target (module, indent='', min_version=(7, 2)) -%} +{% if sphinx_version >= min_version %}
{% else %} +{{ indent }} +{{ indent }}
{% endif %} +{%- endmacro -%} +{% set permalink = ("Link" if sphinx_version >= (7, 2) else 'Permalink') -%} +{% set heading = ("heading" if sphinx_version >= (5, 0) else 'headline') -%} +{% set sig_prename_tag=("span" if sphinx_version >= (4, 0) else 'code') -%} +{% set sig_object_class=(' class="sig sig-object py"' if sphinx_version >= (4, 0) else '') -%} +{% set section = ("section", "section") if docutils_version >= (0, 17) else ('div class="section"', "div") -%} - += (7, 2) %} data-content_root="./"{% endif %}{% if sphinx_version >= (5, 0) %} lang="en"{% endif %}> - + {% if docutils_version[1] == 18 %}<meta content="Docutils 0.18.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 17 %}<meta content="Docutils 0.17.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 19 %}<meta content="Docutils 0.19: https://docutils.sourceforge.io/" name="generator"/> + {% elif docutils_version[1] >= 20 %}<meta content="width=device-width, initial-scale=1" name="viewport"/> + {% endif %}<title> sphinx-autofixture Demo — Python documentation - - + {% if sphinx_version >= (7, 2) %} + {% if sphinx_version < (6, 0) %} + {% if sphinx_version >= (5, 0) %} + {% endif %}{% endif %} - + {% if sphinx_version >= (5, 2) %} + {% endif %}{% if alabaster_version < (0, 7, 15) %} + {% endif %}
-
+ <{% if docutils_version >= (0, 17) %}section{% else %}div class="section"{% endif %} id="sphinx-autofixture-demo">

sphinx-autofixture Demo - +

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} + +
@@ -90,19 +111,16 @@

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} +

@@ -138,23 +156,18 @@

- - -
-
- {% if sphinx_version >= (3, 5) %} - - class - {% else %} - class{% endif %} + {{ span_target("tests.myproject", " ")}} + + + {{ span_pre("class", " ", (3, 5)) }} - - tests.myproject. - - - A - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("A", " ") }} + +
@@ -163,11 +176,11 @@

My Dataclass

-
- - __dataclass_fields__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_fields__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -176,7 +189,7 @@

{% else %} = {}{% endif %} - +

@@ -184,11 +197,11 @@

-
- - __dataclass_params__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_params__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -197,7 +210,7 @@

{% else %} = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False){% endif %} - +

@@ -205,25 +218,22 @@

-
- - __eq__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__eq__", " ") }} + ( - {% if sphinx_version >= (3, 5) %} - - other - {% else %} - other{% endif %} + + {{ span_pre("other", " ", (3, 5)) }} ) - +
@@ -234,11 +244,11 @@

-
- - __hash__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__hash__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -247,7 +257,7 @@

{% else %} = None{% endif %} - +

@@ -255,37 +265,47 @@

-
- - __init__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__init__", " ") }} + ( ) - {% if sphinx_version >= (3, 5) %} + {% if sphinx_version >= (4, 1) %} + + + → + + + + None + + + {% elif sphinx_version >= (3, 5) %} → None {% else %} → None{% endif %} - +
-
+
{% if sphinx_version < (4, 1) %}

Initialize self. See help(type(self)) for accurate signature. -

+

{% endif %}
-
- - __module__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__module__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -294,7 +314,7 @@

{% else %} = 'tests.myproject'{% endif %} - +

@@ -302,17 +322,17 @@

-
- - __repr__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__repr__", " ") }} + ( ) - +
@@ -323,11 +343,11 @@

-
- - __weakref__ - - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__weakref__", " ") }} + +
@@ -340,20 +360,20 @@

-
- - tests.myproject. - - - baz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("baz", " ") }} + ( ) - +
@@ -364,20 +384,20 @@

-
- - tests.myproject. - - - fizbuzz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("fizbuzz", " ") }} + ( ) - +
@@ -387,7 +407,9 @@

- + = (0, 17) %}section{% else %}div{% endif %}>{% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_directive_/test_output_37_pypy_index_html_.html b/tests/test_directive_/test_output_37_pypy_index_html_.html index f6bc764..ef3551e 100644 --- a/tests/test_directive_/test_output_37_pypy_index_html_.html +++ b/tests/test_directive_/test_output_37_pypy_index_html_.html @@ -1,48 +1,69 @@ +{% macro span_pre(text, indent='', min_version=(3, 5)) -%} +{% if sphinx_version >= min_version %} +{{ indent }} {{ text }} +{{ indent }}{% else %}{{ text }}{% endif %} +{%- endmacro -%} +{% macro span_target (module, indent='', min_version=(7, 2)) -%} +{% if sphinx_version >= min_version %}
{% else %} +{{ indent }} +{{ indent }}
{% endif %} +{%- endmacro -%} +{% set permalink = ("Link" if sphinx_version >= (7, 2) else 'Permalink') -%} +{% set heading = ("heading" if sphinx_version >= (5, 0) else 'headline') -%} +{% set sig_prename_tag=("span" if sphinx_version >= (4, 0) else 'code') -%} +{% set sig_object_class=(' class="sig sig-object py"' if sphinx_version >= (4, 0) else '') -%} +{% set section = ("section", "section") if docutils_version >= (0, 17) else ('div class="section"', "div") -%} - += (7, 2) %} data-content_root="./"{% endif %}{% if sphinx_version >= (5, 0) %} lang="en"{% endif %}> - + {% if docutils_version[1] == 18 %}<meta content="Docutils 0.18.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 17 %}<meta content="Docutils 0.17.1: http://docutils.sourceforge.net/" name="generator"/> + {% elif docutils_version[1] == 19 %}<meta content="Docutils 0.19: https://docutils.sourceforge.io/" name="generator"/> + {% elif docutils_version[1] >= 20 %}<meta content="width=device-width, initial-scale=1" name="viewport"/> + {% endif %}<title> sphinx-autofixture Demo — Python documentation - - + {% if sphinx_version >= (7, 2) %} + {% if sphinx_version < (6, 0) %} + {% if sphinx_version >= (5, 0) %} + {% endif %}{% endif %} - + {% if sphinx_version >= (5, 2) %} + {% endif %}{% if alabaster_version < (0, 7, 15) %} + {% endif %}
-
+ <{% if docutils_version >= (0, 17) %}section{% else %}div class="section"{% endif %} id="sphinx-autofixture-demo">

sphinx-autofixture Demo - +

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} + +
@@ -90,19 +111,16 @@

-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} + + + {{ span_pre("fixture", " ", (3, 5)) }} - - coincidence.fixtures. - - - tmp_pathplus - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("coincidence.fixtures.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("tmp_pathplus", " ") }} +

@@ -138,23 +156,18 @@

- - -
-
- {% if sphinx_version >= (3, 5) %} - - class - {% else %} - class{% endif %} + {{ span_target("tests.myproject", " ")}} + + + {{ span_pre("class", " ", (3, 5)) }} - - tests.myproject. - - - A - - + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("A", " ") }} + +
@@ -163,11 +176,11 @@

My Dataclass

-
- - __dataclass_fields__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_fields__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -176,7 +189,7 @@

{% else %} = {}{% endif %} - +

@@ -184,11 +197,11 @@

-
- - __dataclass_params__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__dataclass_params__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -197,7 +210,7 @@

{% else %} = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False){% endif %} - +

@@ -205,25 +218,22 @@

-
- - __eq__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__eq__", " ") }} + ( - {% if sphinx_version >= (3, 5) %} - - other - {% else %} - other{% endif %} + + {{ span_pre("other", " ", (3, 5)) }} ) - +
@@ -231,11 +241,11 @@

-
- - __hash__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__hash__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -244,7 +254,7 @@

{% else %} = None{% endif %} - +

@@ -252,22 +262,32 @@

-
- - __init__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__init__", " ") }} + ( ) - {% if sphinx_version >= (3, 5) %} + {% if sphinx_version >= (4, 1) %} + + + → + + + + None + + + {% elif sphinx_version >= (3, 5) %} → None {% else %} → None{% endif %} - +
@@ -275,11 +295,11 @@

-
- - __module__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__module__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -288,7 +308,7 @@

{% else %} = 'tests.myproject'{% endif %} - +

@@ -296,17 +316,17 @@

-
- - __repr__ - + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__repr__", " ") }} + ( ) - +
@@ -314,11 +334,11 @@

-
- - __weakref__ - - {% if sphinx_version >= (3, 5) %} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("__weakref__", " ") }} + + {% if (3, 5) <= sphinx_version < (4, 3) %} = @@ -327,7 +347,7 @@

{% else %} = None{% endif %} - +

@@ -337,20 +357,20 @@

-
- - tests.myproject. - - - baz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("baz", " ") }} + ( ) - +
@@ -361,20 +381,20 @@

-
- - tests.myproject. - - - fizbuzz - + + <{{ sig_prename_tag }} class="sig-prename descclassname"> + {{ span_pre("tests.myproject.", " ") }} + + <{{ sig_prename_tag }} class="sig-name descname"> + {{ span_pre("fizbuzz", " ") }} + ( ) - +
@@ -384,7 +404,9 @@

- + = (0, 17) %}section{% else %}div{% endif %}>{% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_directive_/test_output_38_index_html_.html b/tests/test_directive_/test_output_38_index_html_.html deleted file mode 100644 index 7b6cba3..0000000 --- a/tests/test_directive_/test_output_38_index_html_.html +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - sphinx-autofixture Demo — Python documentation - - - - - - - - -
-
-
-
-
-

- sphinx-autofixture Demo - - ¶ - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - - - ¶ - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
-

- - - - coincidence.fixtures.tmp_pathplus - - - -

-
-
- {% if sphinx_version >= (3, 5) %} - - fixture - {% else %} - fixture{% endif %} - - - coincidence.fixtures. - - - tmp_pathplus - -
-
-

- - Scope: - - function -

-

- Pytest fixture which returns a temporary directory in the form of a - - - PathPlus - - - object. -

-

- The directory is unique to each test function invocation, -created as a sub directory of the base temporary directory. -

-

- Use it as follows: -

-
-
-
pytest_plugins = ("coincidence", )
-
-def test_something(tmp_pathplus: PathPlus):
-        assert True
-
-
-
-
-
- - -
-
- {% if sphinx_version >= (3, 5) %} - - class - {% else %} - class{% endif %} - - - tests.myproject. - - - A - - - ¶ - -
-
-

- My Dataclass -

-
-
- - __dataclass_fields__ - - {% if sphinx_version >= (3, 5) %} - - = - - - {} - {% else %} - = {}{% endif %} - - - ¶ - -
-
-
-
-
-
- - __dataclass_params__ - - {% if sphinx_version >= (3, 5) %} - - = - - - _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False) - {% else %} - = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False){% endif %} - - - ¶ - -
-
-
-
-
-
- - __eq__ - - - ( - - - {% if sphinx_version >= (3, 5) %} - - other - {% else %} - other{% endif %} - - - - ) - - - ¶ - -
-
-

- Return self==value. -

-
-
-
-
- - __hash__ - - {% if sphinx_version >= (3, 5) %} - - = - - - None - {% else %} - = None{% endif %} - - - ¶ - -
-
-
-
-
-
- - __init__ - - - ( - - - ) - {% if sphinx_version >= (3, 5) %} - → - - None - {% else %} - → None{% endif %} - - ¶ - -
-
-

- Initialize self. See help(type(self)) for accurate signature. -

-
-
-
-
- - __module__ - - {% if sphinx_version >= (3, 5) %} - - = - - - 'tests.myproject' - {% else %} - = 'tests.myproject'{% endif %} - - - ¶ - -
-
-
-
-
-
- - __repr__ - - - ( - - - ) - - - ¶ - -
-
-

- Return repr(self). -

-
-
-
-
- - __weakref__ - - - ¶ - -
-
-

- list of weak references to the object (if defined) -

-
-
-
-
-
-
- - tests.myproject. - - - baz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
- - tests.myproject. - - - fizbuzz - - - ( - - - ) - - - ¶ - -
-
-

- A locally defined function. -

-
-
-
-
-
-
-
-
-
- - diff --git a/tests/test_sphinx_version.py b/tests/test_sphinx_version.py new file mode 100644 index 0000000..14846f2 --- /dev/null +++ b/tests/test_sphinx_version.py @@ -0,0 +1,22 @@ +# stdlib +import os +import re + +# 3rd party +import sphinx +from domdf_python_tools.compat import importlib_metadata + + +def test_sphinx_version_against_tox(): + m = re.match(r"py.*-sphinx(\d)\.(\d)", os.getenv("TOX_ENV_NAME", '')) + if m is not None: + target_version = tuple(map(int, m.groups())) + assert target_version == sphinx.version_info[:2] + + +def test_pytest_version_against_tox(): + m = re.match(r"py.*-pytest(\d)\.(\d)", os.getenv("TOX_ENV_NAME", '')) + if m is not None: + target_version = tuple(map(int, m.groups())) + pytest_version = tuple(map(int, importlib_metadata.version("pytest").split('.')[:2])) + assert target_version == pytest_version diff --git a/tox.ini b/tox.ini index e185474..d8972dd 100644 --- a/tox.ini +++ b/tox.ini @@ -2,10 +2,15 @@ # You may add new sections, but any changes made to the following sections will be lost: # * tox # * envlists -# * testenv +# * testenv:.package +# * testenv:py313-dev +# * testenv:py313 +# * testenv:py312-dev +# * testenv:py312 # * testenv:docs # * testenv:build # * testenv:lint +# * testenv:perflint # * testenv:mypy # * testenv:pyup # * testenv:coverage @@ -17,82 +22,108 @@ [tox] envlist = - py36-sphinx{3.2,3.3,3.4,3.5} - py37-sphinx{3.2,3.3,3.4,3.5} - py38-sphinx{3.2,3.3,3.4,3.5} - py39-sphinx{3.2,3.3,3.4,3.5} - py310-dev-sphinx{3.2,3.3,3.4,3.5} - pypy36-sphinx{3.2,3.3,3.4,3.5} - pypy37-sphinx{3.2,3.3,3.4,3.5} + py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3} + py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} + py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} + py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1} + py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3} + pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} + pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} + py37-pytest7.4 + py38-pytest{7.4,8.3} + py39-pytest{7.4,8.3,latest} + py310-pytest{7.4,8.3,latest} + py311-pytest{7.4,8.3,latest} + py312-pytest{7.4,8.3,latest} + py313-pytest{8.3,latest} + pypy37-pytest7.4 + pypy38-pytest{7.4,8.3} + pypy39-pytest{7.4,8.3,latest} mypy build skip_missing_interpreters = True isolated_build = True requires = - pip>=21 + pip>=21,!=22.2 tox-envlist>=0.2.1 + tox~=3.0 + virtualenv!=20.16.0 [envlists] test = - py36-sphinx{3.2,3.3,3.4,3.5} - py37-sphinx{3.2,3.3,3.4,3.5} - py38-sphinx{3.2,3.3,3.4,3.5} - py39-sphinx{3.2,3.3,3.4,3.5} - py310-dev-sphinx{3.2,3.3,3.4,3.5} - pypy36-sphinx{3.2,3.3,3.4,3.5} - pypy37-sphinx{3.2,3.3,3.4,3.5} + py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3} + py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} + py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} + py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1} + py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3} + pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} + pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} + py37-pytest7.4 + py38-pytest{7.4,8.3} + py39-pytest{7.4,8.3,latest} + py310-pytest{7.4,8.3,latest} + py311-pytest{7.4,8.3,latest} + py312-pytest{7.4,8.3,latest} + py313-pytest{8.3,latest} + pypy37-pytest7.4 + pypy38-pytest{7.4,8.3} + pypy39-pytest{7.4,8.3,latest} qa = mypy, lint -cov = py36-sphinx3.2, coverage +cov = py39-sphinx3.2, coverage -[testenv] +[testenv:.package] setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 -deps = - -r{toxinidir}/tests/requirements.txt - sphinx3.2: sphinx~=3.2.0 - sphinx3.3: sphinx~=3.3.0 - sphinx3.4: sphinx~=3.4.0 - sphinx3.5: sphinx~=3.5.0 -commands = - python --version - python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} [testenv:docs] setenv = SHOW_TODOS = 1 +passenv = SPHINX_BUILDER basepython = python3.8 changedir = {toxinidir}/doc-source deps = -r{toxinidir}/doc-source/requirements.txt commands = sphinx-build -M {env:SPHINX_BUILDER:html} . ./build {posargs} [testenv:build] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + PIP_PREFER_BINARY=1 + UNSAFE_PYO3_SKIP_VERSION_CHECK=1 skip_install = True changedir = {toxinidir} deps = build[virtualenv]>=0.3.1 check-wheel-contents>=0.1.0 twine>=3.2.0 + cryptography<40; implementation_name == "pypy" and python_version <= "3.7" commands = python -m build --sdist --wheel "{toxinidir}" twine check dist/*.tar.gz dist/*.whl check-wheel-contents dist/ [testenv:lint] -basepython = python3.6 +basepython = python3.9 changedir = {toxinidir} ignore_errors = True skip_install = True deps = - flake8>=3.8.2 + flake8>=3.8.2,<5 flake8-2020>=1.6.0 flake8-builtins>=1.5.3 flake8-docstrings>=1.5.0 flake8-dunder-all>=0.1.1 flake8-encodings>=0.1.0 flake8-github-actions>=0.1.0 - flake8-noqa>=1.1.0 - flake8-pyi>=20.10.0 - flake8-pytest-style>=1.3.0 + flake8-noqa>=1.1.0,<=1.2.2 + flake8-pyi>=20.10.0,<=22.8.0 + flake8-pytest-style>=1.3.0,<2 flake8-quotes>=3.3.0 flake8-slots>=0.1.0 flake8-sphinx-links>=0.0.4 @@ -101,23 +132,32 @@ deps = git+https://github.com/domdfcoding/flake8-rst-docstrings-sphinx.git git+https://github.com/domdfcoding/flake8-rst-docstrings.git git+https://github.com/python-formate/flake8-unused-arguments.git@magic-methods - pydocstyle>=6.0.0 + git+https://github.com/python-formate/flake8-missing-annotations.git + git+https://github.com/domdfcoding/pydocstyle.git@stub-functions pygments>=2.7.1 importlib_metadata<4.5.0; python_version<'3.8' commands = python3 -m flake8_rst_docstrings_sphinx sphinx_autofixture tests --allow-toolbox {posargs} +[testenv:perflint] +basepython = python3.9 +changedir = {toxinidir} +ignore_errors = True +skip_install = True +deps = perflint +commands = python3 -m perflint sphinx_autofixture {posargs} + [testenv:mypy] -basepython = python3.6 +basepython = python3.9 ignore_errors = True changedir = {toxinidir} deps = - mypy==0.942 + mypy==1.16 -r{toxinidir}/tests/requirements.txt -r{toxinidir}/stubs.txt commands = mypy sphinx_autofixture tests {posargs} [testenv:pyup] -basepython = python3.6 +basepython = python3.9 skip_install = True ignore_errors = True changedir = {toxinidir} @@ -125,7 +165,7 @@ deps = pyupgrade-directories commands = pyup_dirs sphinx_autofixture tests --py36-plus --recursive [testenv:coverage] -basepython = python3.6 +basepython = python3.9 skip_install = True ignore_errors = True whitelist_externals = /bin/bash @@ -133,6 +173,7 @@ passenv = COV_PYTHON_VERSION COV_PLATFORM COV_PYTHON_IMPLEMENTATION + * changedir = {toxinidir} deps = coverage>=5 @@ -144,7 +185,7 @@ commands = [flake8] max-line-length = 120 -select = E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E225 E226 E227 E228 E231 E241 E242 E251 E261 E262 E265 E271 E272 E303 E304 E306 E402 E502 E703 E711 E712 E713 E714 E721 W291 W292 W293 W391 W504 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 A003 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 ENC001 ENC002 ENC003 ENC004 ENC011 ENC012 ENC021 ENC022 ENC023 ENC024 ENC025 ENC026 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 NQA001 NQA002 NQA003 NQA004 NQA005 NQA102 NQA103 E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 +select = E111 E112 E113 E121 E122 E125 E127 E128 E129 E131 E133 E201 E202 E203 E211 E222 E223 E224 E225 E225 E226 E227 E228 E231 E241 E242 E251 E261 E262 E265 E271 E272 E303 E304 E306 E402 E502 E703 E711 E712 E713 E714 E721 W291 W292 W293 W391 W504 YTT101 YTT102 YTT103 YTT201 YTT202 YTT203 YTT204 YTT301 YTT302 YTT303 STRFTIME001 STRFTIME002 SXL001 PT001 PT002 PT003 PT006 PT007 PT008 PT009 PT010 PT011 PT012 PT013 PT014 PT015 PT016 PT017 PT018 PT019 PT020 PT021 RST201 RST202 RST203 RST204 RST205 RST206 RST207 RST208 RST210 RST211 RST212 RST213 RST214 RST215 RST216 RST217 RST218 RST219 RST299 RST301 RST302 RST303 RST304 RST305 RST306 RST399 RST401 RST499 RST900 RST901 RST902 RST903 Q001 Q002 Q003 A001 A002 TYP001 TYP002 TYP003 TYP004 TYP005 TYP006 ENC001 ENC002 ENC003 ENC004 ENC011 ENC012 ENC021 ENC022 ENC023 ENC024 ENC025 ENC026 Y001,Y002 Y003 Y004 Y005 Y006 Y007 Y008 Y009 Y010 Y011 Y012 Y013 Y014 Y015 Y090 Y091 NQA001 NQA002 NQA003 NQA004 NQA005 NQA102 NQA103 E301 E302 E305 D100 D101 D102 D103 D104 D106 D201 D204 D207 D208 D209 D210 D211 D212 D213 D214 D215 D300 D301 D400 D402 D403 D404 D415 D417 DALL000 SLOT000 SLOT001 SLOT002 extend-exclude = doc-source,old,build,dist,__pkginfo__.py,setup.py,venv rst-directives = TODO @@ -161,7 +202,7 @@ inline-quotes = " multiline-quotes = """ docstring-quotes = """ count = True -min_python_version = 3.6.1 +min_python_version = 3.7 unused-arguments-ignore-abstract-functions = True unused-arguments-ignore-overload-functions = True unused-arguments-ignore-magic-methods = True @@ -172,13 +213,14 @@ plugins = coverage_pyver_pragma [coverage:report] fail_under = 95 +show_missing = True exclude_lines = raise AssertionError raise NotImplementedError if 0: if False: - if TYPE_CHECKING: - if typing.TYPE_CHECKING: + if TYPE_CHECKING + if typing.TYPE_CHECKING if __name__ == .__main__.: [check-wheel-contents] @@ -189,3 +231,182 @@ package = sphinx_autofixture [pytest] addopts = --color yes --durations 25 timeout = 300 +filterwarnings = + error + ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning + ignore:'contextfunction' is renamed to 'pass_context', the old name will be removed in Jinja 3.1.:DeprecationWarning + ignore:'environmentfilter' is renamed to 'pass_environment', the old name will be removed in Jinja 3.1.:DeprecationWarning + always:distutils Version classes are deprecated. Use packaging.version instead.:DeprecationWarning + ignore:The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives:DeprecationWarning + ignore::DeprecationWarning:certifi + always:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning + always:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning + always:The `docutils.parsers.rst.directive.html` module will be removed in Docutils 1.2.:DeprecationWarning + always:The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. + always:The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead. + always:pkg_resources is deprecated as an API:DeprecationWarning + always:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning + always:datetime.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version:DeprecationWarning:sphinx.builders.gettext + always:datetime.datetime.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version.:DeprecationWarning:sphinx.builders.gettext + always:The alias 'sphinx.util.SkipProgressMessage' is deprecated, use 'sphinx.util.display.SkipProgressMessage' instead:DeprecationWarning:sphinxcontrib.applehelp + always:The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.http_date.epoch_to_rfc1123' instead.:DeprecationWarning:sphinxcontrib.applehelp + always:The alias 'sphinx.util.typing.stringify' is deprecated, use 'sphinx.util.typing.stringify_annotation' instead. Check CHANGES for Sphinx API modifications.:DeprecationWarning +markers = sphinx + +[testenv] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + SETUPTOOLS_USE_DISTUTILS=stdlib +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt + sphinx3.2: sphinx==3.2.1 + sphinx3.3: sphinx==3.3.1 + sphinx3.4: sphinx==3.4.3 + sphinx3.5: sphinx==3.5.4 + sphinx3.{2,3,4,5}: docutils==0.16 + sphinx4.0: sphinx==4.0.3 + sphinx4.1: sphinx==4.1.2 + sphinx4.2: sphinx==4.2.0 + sphinx4.3: sphinx==4.3.2 + sphinx4.4: sphinx==4.4.0 + sphinx4.5: sphinx==4.5.0 + sphinx4.{0,1,2,3,4,5}: docutils==0.17.1 + sphinx5.0: sphinx==5.0.2 + sphinx5.1: sphinx==5.1.1 + sphinx5.2: sphinx==5.2.3 + sphinx5.3: sphinx==5.3.0 + sphinx6.0: sphinx==6.0.1 + sphinx6.1: sphinx==6.1.3 + sphinx6.2: sphinx==6.2.1 + sphinx7.0: sphinx==7.0.1 + sphinx7.1: sphinx==7.1.2 + + sphinxcontrib-applehelp<=1.0.4 + sphinxcontrib-devhelp<=1.0.2 + sphinxcontrib-htmlhelp<=2.0.1 + sphinxcontrib-jsmath<=1.0.1 + sphinxcontrib-qthelp<=1.0.3 + sphinxcontrib-serializinghtml<=1.1.5 + alabaster<=0.7.13 +commands = + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{39,310,311,312,313,py39}-sphinx7.2] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==7.2.6 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{39,310,311,312,313,py39}-sphinx7.3] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==7.3.7 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{39,310,311,312,313,py39}-sphinx7.4] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==7.4.7 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{310,311,312,313}-sphinx8.0] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==8.0.2 + pip install pygments>=2.7.4,<=2.13.0 alabaster==0.7.16 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{310,311,312,313}-sphinx8.1] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==8.1.3 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{311,312,313}-sphinx8.2] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +commands = + pip install sphinx==8.2.1 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{37,38,39,310,311,312,313,py37,py38,py39}-pytest7.4] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt + pytest~=7.4.0 +commands = + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{38,39,310,311,312,313,py38,py39}-pytest8.3] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt + pytest~=8.3.0 +commands = + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs} + +[testenv:py{39,310,311,312,313,py39}-pytestlatest] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt + pytest +commands = + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_autofixture -r aR tests/ {posargs}