run unit test on windows ci (#9187)

* factor out testing_minimal in setup.py [pr]

* testing_unit + windows
This commit is contained in:
chenyu
2025-02-20 14:40:41 -05:00
committed by GitHub
parent 287de4ecc6
commit 3e22747799
3 changed files with 21 additions and 15 deletions
+5 -2
View File
@@ -263,7 +263,7 @@ jobs:
uses: ./.github/actions/setup-tinygrad
with:
key: unittest-12
deps: testing
deps: testing_unit
- name: Test README
run: awk '/```python/{flag=1;next}/```/{flag=0}flag' README.md > README.py && PYTHONPATH=. python README.py
- name: Run unit tests
@@ -624,10 +624,13 @@ jobs:
uses: ./.github/actions/setup-tinygrad
with:
key: windows-minimal
deps: testing_minimal
deps: testing_unit
- name: Set env
shell: bash
run: printf "${{ matrix.backend == 'llvm' && 'LLVM=1' || matrix.backend == 'clang' && 'CLANG=1'}}" >> $GITHUB_ENV
- name: Run unit tests
if: matrix.backend=='llvm'
run: python -m pytest -n=auto test/unit/ --ignore=test/unit/test_disk_tensor.py --ignore=test/unit/test_elf.py --ignore=test/unit/test_tar.py
- name: Run pytest (${{ matrix.backend }})
shell: bash
run: |
+14 -12
View File
@@ -7,6 +7,14 @@ directory = Path(__file__).resolve().parent
with open(directory / 'README.md', encoding='utf-8') as f:
long_description = f.read()
testing_minimal = [
"numpy",
"torch",
"pytest",
"pytest-xdist",
"hypothesis",
]
setup(name='tinygrad',
version='0.10.1',
description='You like pytorch? You like micrograd? You love tinygrad! <3',
@@ -35,19 +43,14 @@ setup(name='tinygrad',
"types-tqdm",
],
#'mlperf': ["mlperf-logging @ git+https://github.com/mlperf/[email protected]"],
'testing_minimal': [
"numpy",
"torch",
"pytest",
"pytest-xdist",
"hypothesis",
'testing_minimal': testing_minimal,
'testing_unit': testing_minimal + [
"tqdm",
"safetensors",
"tabulate" # for sz.py
],
'testing': [
"numpy",
"torch",
'testing': testing_minimal + [
"pillow",
"pytest",
"pytest-xdist",
"onnx==1.16.0",
"onnx2torch",
"opencv-python",
@@ -60,7 +63,6 @@ setup(name='tinygrad',
"blobfile",
"librosa",
"networkx",
"hypothesis",
"nibabel",
"bottle",
"ggml-python",
+2 -1
View File
@@ -1,5 +1,4 @@
import gzip, unittest
from PIL import Image
from tinygrad import Variable
from tinygrad.helpers import Context, ContextVar
from tinygrad.helpers import merge_dicts, strip_parens, prod, round_up, fetch, fully_flatten, from_mv, to_mv, polyN, time_to_str
@@ -126,11 +125,13 @@ class TestFetch(unittest.TestCase):
assert (len(fetch('https://google.com', allow_caching=False).read_bytes())>0)
def test_fetch_img(self):
from PIL import Image
img = fetch("https://avatars.githubusercontent.com/u/132956020", allow_caching=False)
with Image.open(img) as pimg:
assert pimg.size == (77, 77), pimg.size
def test_fetch_subdir(self):
from PIL import Image
img = fetch("https://avatars.githubusercontent.com/u/132956020", allow_caching=False, subdir="images")
with Image.open(img) as pimg:
assert pimg.size == (77, 77), pimg.size