Skip to content

Commit

Permalink
Update next-gen with recent changes to master (pytest-dev#494)
Browse files Browse the repository at this point in the history
* remove phantomjs dependency (pytest-dev#424)

* properly classify all npm dependencies (pytest-dev#425)

* Move the changelog to read the docs (pytest-dev#423)

* split plugin.py into smaller files (pytest-dev#427)

* Implement the visible URL query parameter to control visibility of test results on page load. (pytest-dev#433)

* enable control of test result visability via query params

* Allow for redacting of environment table values (pytest-dev#431)

* Disable Codecov (pytest-dev#480)

* Disable Codecov

* Disable pypy3 on mac

* Add Tests.yml reusable workflow (pytest-dev#484)

* Use the tests reusable workflow (pytest-dev#486)

* Migrate to precommit.ci (pytest-dev#487)

* Separate Nightly workflow (pytest-dev#488)

Co-authored-by: Gleb Nikonorov <gleb.i.nikonorov@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 3, 2023
1 parent 469a09e commit 0b3936a
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Expand Up @@ -29,7 +29,7 @@ jobs:
run: python -m tox -e docs

tests:
uses: ./.github/workflows/tests.yml
uses: pytest-dev/pytest-html/.github/workflows/tests.yml@master

publish:
name: Publish to PyPI registry
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/nightly.yml
Expand Up @@ -6,5 +6,4 @@ on:

jobs:
tests:
if: github.repository_owner == 'pytest-dev'
uses: ./.github/workflows/tests.yml
uses: pytest-dev/pytest-html/.github/workflows/tests.yml@master
68 changes: 25 additions & 43 deletions .github/workflows/tests.yml
Expand Up @@ -8,9 +8,20 @@ jobs:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: py36-ubuntu
python-version: 3.6

- os: windows-latest
name: py36-windows
python-version: 3.6

- os: macOS-latest
name: py36-mac
python-version: 3.6

- os: ubuntu-latest
name: py37-ubuntu
python-version: 3.7
Expand Down Expand Up @@ -47,31 +58,18 @@ jobs:
name: py39-mac
python-version: 3.9

- os: ubuntu-latest
name: py310-ubuntu
python-version: '3.10'

- os: windows-latest
name: py310-windows
python-version: '3.10'

- os: macOS-latest
name: py310-mac
python-version: '3.10'

- os: ubuntu-latest
name: pypy3-ubuntu
python-version: pypy-3.8
python-version: pypy3

# TODO: This test takes 10(!) times as long as the regular py38 on Windows
# - os: windows-latest
# name: pypy3-windows
# python-version: pypy-3.8
- os: windows-latest
name: pypy3-windows
python-version: pypy3

# https://github.com/pytest-dev/pytest-html/issues/482
- os: macOS-latest
name: pypy3-mac
python-version: pypy-3.8
# - os: macOS-latest
# name: pypy3-mac
# python-version: pypy3

- os: ubuntu-latest
name: devel-ubuntu
Expand All @@ -80,37 +78,21 @@ jobs:
steps:
- name: Set Newline Behavior
run : git config --global core.autocrlf false

- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v2
with:
python-version: ${{ matrix['python-version'] }}

- name: Upgrade pip
run: python -m pip install --upgrade pip

- name: Install tox
run: python -m pip install --upgrade tox

- name: Get Tox Environment Name From Matrix Name
uses: rishabhgupta/split-by@v1
id: split-matrix-name
with:
string: '${{ matrix.name }}'
split-by: '-'

- name: Test with coverage
if: "! contains(matrix.name, 'pypy3')"
run: python -m tox -rvv -e ${{ steps.split-matrix-name.outputs._0}}-cov

- name: Test without coverage
if: "contains(matrix.name, 'pypy3')"
run: python -m tox -e ${{ steps.split-matrix-name.outputs._0}}

- name: Test with tox
run: python -m tox -e ${{ steps.split-matrix-name.outputs._0}}-cov
# TODO: https://github.com/pytest-dev/pytest-html/issues/481
# - name: Upload coverage to codecov
# if: github.event.schedule == ''
Expand All @@ -126,9 +108,9 @@ jobs:
name: grunt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Dependencies
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -37,13 +37,13 @@ repos:
hooks:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.13.0
hooks:
- id: eslint
additional_dependencies:
- eslint@7.13.0
args: [src]
# - repo: https://github.com/pre-commit/mirrors-eslint
# rev: v7.13.0
# hooks:
# - id: eslint
# additional_dependencies:
# - eslint@7.13.0
# args: [src]
- repo: local
hooks:
- id: rst
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -8,4 +8,3 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/pytest_html/__version.py"

2 changes: 1 addition & 1 deletion src/pytest_html/html_report.py
Expand Up @@ -178,7 +178,7 @@ def _generate_report(self, session):
]

with open(
os.path.join(os.path.dirname(__file__), "resources", "main.js")
os.path.join(os.path.dirname(__file__), "resources", "old_main.js")
) as main_js_fp:
main_js = main_js_fp.read()

Expand Down
2 changes: 1 addition & 1 deletion src/pytest_html/plugin.py
Expand Up @@ -4,12 +4,12 @@
import os

import pytest
from _pytest.pathlib import Path

from . import extras # noqa: F401
from .html_report import HTMLReport
from .nextgen import NextGenReport

from _pytest.pathlib import Path

def pytest_addhooks(pluginmanager):
from . import hooks
Expand Down
14 changes: 7 additions & 7 deletions src/pytest_html/resources/index.html
Expand Up @@ -64,17 +64,17 @@ <h2>Environment</h2>
<h2>Summary</h2>
<p class="run-count"></p>
<p class="filter">(Un)check the boxes to filter the results.</p>
<input checked="true" class="filter" data-test-result="error" name="filter_checkbox" type="checkbox"/><span class="error"></span>

<input checked="true" class="filter" data-test-result="error" name="filter_checkbox" type="checkbox"/><span class="error"></span>
<input checked="true" class="filter" data-test-result="failed" name="filter_checkbox" type="checkbox"/><span class="failed"></span>
<input checked="true" class="filter" data-test-result="rerun" name="filter_checkbox" type="checkbox"/><span class="rerun"></span>
<input checked="true" class="filter" data-test-result="xfailed" name="filter_checkbox" type="checkbox"/><span class="xfailed"></span>
<input checked="true" class="filter" data-test-result="xpassed" name="filter_checkbox" type="checkbox"/><span class="xpassed"></span>
<input checked="true" class="filter" data-test-result="xfailed" name="filter_checkbox" type="checkbox"/><span class="xfailed"></span>
<input checked="true" class="filter" data-test-result="xpassed" name="filter_checkbox" type="checkbox"/><span class="xpassed"></span>
<input checked="true" class="filter" data-test-result="passed" name="filter_checkbox" type="checkbox"/><span class="passed"></span>
<input checked="true" class="filter" data-test-result="skipped" name="filter_checkbox" type="checkbox"/><span class="skipped"></span>



</div>
<div class="summary__reload">
<div class="summary__reload__button" onclick="location.reload()">
Expand All @@ -86,7 +86,7 @@ <h2>Summary</h2>
</div>
<h2>Results</h2>
<table id="results-table">

</table>
</body>
<footer>
Expand All @@ -97,4 +97,4 @@ <h2>Results</h2>
<script src="index.js"></script>
<script src="main.js"></script>
</footer>
</html>
</html>
10 changes: 5 additions & 5 deletions src/pytest_html/resources/main.js
Expand Up @@ -61,8 +61,8 @@ function addCollapse() {
const resulttable = find('table#results-table');
const showhideall = document.createElement('p');
showhideall.innerHTML =
'<a href="javascript:showAllExtras()">Show all details</a> / ' +
'<a href="javascript:hideAllExtras()">Hide all details</a>';
'<a href="javascript:showAllExtras()">Show all details</a> / ' +
'<a href="javascript:hideAllExtras()">Hide all details</a>';
resulttable.parentElement.insertBefore(showhideall, resulttable);

// Add show/hide link to each result
Expand All @@ -82,9 +82,9 @@ function addCollapse() {

elem.addEventListener('click', function (event) {
if (
event.currentTarget.parentNode.nextElementSibling.classList.contains(
'collapsed'
)
event.currentTarget.parentNode.nextElementSibling.classList.contains(
'collapsed'
)
) {
showExtras(event.currentTarget);
} else {
Expand Down

0 comments on commit 0b3936a

Please sign in to comment.