@@ -65,10 +65,11 @@ def decorator(fn):
6565
6666
6767@downstream_test ('hpy' )
68- def downstream_test_hpy (graalpy , args = None , env = None , check = True , timeout = None ):
69- testdir = Path ('upstream-tests' ).absolute ()
70- shutil .rmtree (testdir , ignore_errors = True )
71- testdir .mkdir (exist_ok = True )
68+ def downstream_test_hpy (graalpy , testdir = None , args = None , env = None , check = True , timeout = None ):
69+ if not testdir :
70+ testdir = Path ('upstream-tests' ).absolute ()
71+ shutil .rmtree (testdir , ignore_errors = True )
72+ testdir .mkdir (exist_ok = True )
7273 hpy_root = DIR / "graalpython" / "hpy"
7374 shutil .copytree (hpy_root , testdir / "hpy" )
7475 hpy_root = testdir / "hpy"
@@ -101,10 +102,7 @@ def downstream_test_hpy(graalpy, args=None, env=None, check=True, timeout=None):
101102
102103
103104@downstream_test ('pybind11' )
104- def downstream_test_pybind11 (graalpy ):
105- testdir = Path ('upstream-tests' ).absolute ()
106- shutil .rmtree (testdir , ignore_errors = True )
107- testdir .mkdir (exist_ok = True )
105+ def downstream_test_pybind11 (graalpy , testdir ):
108106 run (['git' , 'clone' , 'https://github.com/pybind/pybind11.git' ], cwd = testdir )
109107 src = testdir / 'pybind11'
110108 venv = src / 'venv'
@@ -120,10 +118,7 @@ def downstream_test_pybind11(graalpy):
120118
121119
122120@downstream_test ('virtualenv' )
123- def downstream_test_virtualenv (graalpy ):
124- testdir = Path ('upstream-tests' ).absolute ()
125- shutil .rmtree (testdir , ignore_errors = True )
126- testdir .mkdir (exist_ok = True )
121+ def downstream_test_virtualenv (graalpy , testdir ):
127122 run (['git' , 'clone' , 'https://github.com/pypa/virtualenv.git' , '-b' , 'main' ], cwd = testdir )
128123 src = testdir / 'virtualenv'
129124 venv = src / 'venv'
@@ -142,10 +137,7 @@ def downstream_test_virtualenv(graalpy):
142137
143138
144139@downstream_test ('pyo3' )
145- def downstream_test_pyo3 (graalpy ):
146- testdir = Path ('upstream-tests' ).absolute ()
147- shutil .rmtree (testdir , ignore_errors = True )
148- testdir .mkdir (exist_ok = True )
140+ def downstream_test_pyo3 (graalpy , testdir ):
149141 run (['git' , 'clone' , 'https://github.com/PyO3/pyo3.git' , '-b' , 'main' ], cwd = testdir )
150142 src = testdir / 'pyo3'
151143 venv = src / 'venv'
@@ -154,8 +146,28 @@ def downstream_test_pyo3(graalpy):
154146 run_in_venv (venv , ['nox' , '-s' , 'test-py' ], cwd = src )
155147
156148
149+ @downstream_test ('pydantic-core' )
150+ def downstream_test_pydantic_core (graalpy , testdir ):
151+ # XXX https://github.com/pydantic/pydantic-core/pull/1771 not merged yet
152+ # run(['git', 'clone', 'https://github.com/pydantic/pydantic-core.git', '-b', 'main'], cwd=testdir)
153+ run (['git' , 'clone' , 'https://github.com/msimacek/pydantic-core.git' , '-b' , 'msimacek/graalpy' ], cwd = testdir )
154+ src = testdir / 'pydantic-core'
155+ run (['uv' , 'sync' , '--python' , graalpy , '--group' , 'testing' ], cwd = src )
156+ # XXX UNSAFE_PYO3_SKIP_VERSION_CHECK should not be necessary once pydantic-core updates to a newer pyo3 version
157+ run (['uv' , 'pip' , 'install' , '-e' , '.' ], cwd = src , env = {** os .environ , 'UNSAFE_PYO3_SKIP_VERSION_CHECK' : '1' })
158+ # XXX remove after hypothesis PR merged and released
159+ run (['uv' , 'pip' , 'install' ,
160+ 'git+https://github.com/msimacek/hypothesis@msimacek/graalpy#egg=hypothesis&subdirectory=hypothesis-python' ],
161+ cwd = src )
162+ run (['uv' , 'run' , 'pytest' , '-v' , '--tb=short' ], cwd = src )
163+
164+
157165def run_downstream_test (python , project ):
158- DOWNSTREAM_TESTS [project ](python )
166+ testdir = Path ('upstream-tests' ).absolute ()
167+ shutil .rmtree (testdir , ignore_errors = True )
168+ testdir .mkdir (exist_ok = True )
169+ python = os .path .abspath (python )
170+ DOWNSTREAM_TESTS [project ](python , testdir )
159171
160172
161173def main ():
0 commit comments