Skip to content

Commit 667efae

Browse files
committed
chore: test run in CI and see how it goes
1 parent a2fd34d commit 667efae

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

.github/workflows/artifact.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
GIT_HASH: ${{ github.sha }}
3434
with:
3535
commands: |
36-
uv run beet
36+
uv run pytest
3737
- name: Upload dist folder
3838
run: tar -czvf dist-ubuntu.tar.gz dist/
3939
- name: Upload compressed dist folder
@@ -71,7 +71,7 @@ jobs:
7171
GIT_HASH: ${{ github.sha }}
7272
with:
7373
commands: |
74-
uv run beet
74+
uv run pytest
7575
- name: Upload dist folder
7676
run: Compress-Archive -Path dist\* -DestinationPath dist-windows.zip
7777
- name: Upload compressed dist folder

tests/conftest.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from PIL import ImageChops
2+
import numpy as np
3+
from beet.core.file import PngFile
4+
5+
_TOLERANCE = 1
6+
7+
_original_content_equal = PngFile.content_equal
8+
9+
10+
def _content_equal_with_tolerance(self, other):
11+
left, right = self.image, other.image
12+
if left.size != right.size:
13+
return False
14+
if left.mode != right.mode:
15+
left = left.convert("RGBA")
16+
right = right.convert("RGBA")
17+
diff = ImageChops.difference(left, right)
18+
extrema = diff.getextrema()
19+
if isinstance(extrema[0], int):
20+
# Single-channel image: extrema is (min, max)
21+
return extrema[1] <= _TOLERANCE
22+
# Multi-channel image: extrema is ((min, max), (min, max), ...)
23+
return all(max_val <= _TOLERANCE for _, max_val in extrema)
24+
25+
26+
PngFile.content_equal = _content_equal_with_tolerance

0 commit comments

Comments
 (0)