Skip to content

Commit a726237

Browse files
authored
🧪 add regression test for available material icons (#224)
1 parent 0b178a9 commit a726237

File tree

7 files changed

+10760
-3
lines changed

7 files changed

+10760
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
run: |
6464
pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing
6565
- name: Upload to Codecov
66-
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
66+
if: github.event.pull_request.head.repo.full_name == github.repository && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
6767
uses: codecov/codecov-action@v3
6868
with:
6969
token: ${{ secrets.CODECOV_TOKEN }}

tests/test_misc.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from sphinx_design.icons import get_octicon_data
1+
import pytest
2+
3+
from sphinx_design.icons import get_material_icon_data, get_octicon_data
24

35

46
def test_octicons(file_regression):
@@ -10,6 +12,21 @@ def test_octicons(file_regression):
1012
"""
1113
data = get_octicon_data()
1214
content = ""
13-
for octicon in sorted(get_octicon_data()):
15+
for octicon in sorted(data):
1416
content += f"{octicon}: {','.join(data[octicon]['heights'])}\n"
1517
file_regression.check(content)
18+
19+
20+
@pytest.mark.parametrize("style", ["regular", "outlined", "round", "sharp", "twotone"])
21+
def test_material(style, file_regression):
22+
"""Test the available material icons names.
23+
24+
This is intended to provide a diff of the octicons available,
25+
when the octicons are updated, to check if we are removing any
26+
(and hence breaking back-compatibility).
27+
"""
28+
data = get_material_icon_data(style)
29+
content = ""
30+
for name in sorted(data):
31+
content += f"{name}: {','.join(data[name]['heights'])}\n"
32+
file_regression.check(content)

0 commit comments

Comments
 (0)