Skip to content

Commit

Permalink
🧪 add regression test for available material icons (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Sep 16, 2024
1 parent 0b178a9 commit a726237
Show file tree
Hide file tree
Showing 7 changed files with 10,760 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
run: |
pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing
- name: Upload to Codecov
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
if: github.event.pull_request.head.repo.full_name == github.repository && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
21 changes: 19 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from sphinx_design.icons import get_octicon_data
import pytest

from sphinx_design.icons import get_material_icon_data, get_octicon_data


def test_octicons(file_regression):
Expand All @@ -10,6 +12,21 @@ def test_octicons(file_regression):
"""
data = get_octicon_data()
content = ""
for octicon in sorted(get_octicon_data()):
for octicon in sorted(data):
content += f"{octicon}: {','.join(data[octicon]['heights'])}\n"
file_regression.check(content)


@pytest.mark.parametrize("style", ["regular", "outlined", "round", "sharp", "twotone"])
def test_material(style, file_regression):
"""Test the available material icons names.
This is intended to provide a diff of the octicons available,
when the octicons are updated, to check if we are removing any
(and hence breaking back-compatibility).
"""
data = get_material_icon_data(style)
content = ""
for name in sorted(data):
content += f"{name}: {','.join(data[name]['heights'])}\n"
file_regression.check(content)
Loading

0 comments on commit a726237

Please sign in to comment.