@@ -52,10 +52,11 @@ def test_parse_wheel_url3():
5252 assert wheel .tags == frozenset ({Tag ("cp35" , "cp35m" , "macosx_10_9_intel" )})
5353
5454
55- def create_transaction (Transaction ):
55+ def create_transaction (Transaction , compat_layer ):
5656 from micropip .package_index import DEFAULT_INDEX_URLS
5757
5858 return Transaction (
59+ _compat_layer = compat_layer ,
5960 wheels = [],
6061 locked = {},
6162 keep_going = True ,
@@ -71,12 +72,12 @@ def create_transaction(Transaction):
7172
7273
7374@pytest .mark .asyncio
74- async def test_add_requirement (wheel_catalog ):
75+ async def test_add_requirement (wheel_catalog , host_compat_layer ):
7576 from micropip .transaction import Transaction
7677
7778 snowballstemmer_wheel = wheel_catalog .get ("snowballstemmer" )
7879
79- transaction = create_transaction (Transaction )
80+ transaction = create_transaction (Transaction , host_compat_layer )
8081 await transaction .add_requirement (snowballstemmer_wheel .url )
8182
8283 wheel = transaction .wheels [0 ]
@@ -90,10 +91,10 @@ async def test_add_requirement(wheel_catalog):
9091
9192
9293@pytest .mark .asyncio
93- async def test_add_requirement_marker (mock_importlib , wheel_base ):
94+ async def test_add_requirement_marker (mock_importlib , wheel_base , host_compat_layer ):
9495 from micropip .transaction import Transaction
9596
96- transaction = create_transaction (Transaction )
97+ transaction = create_transaction (Transaction , host_compat_layer )
9798
9899 await transaction .gather_requirements (
99100 [
@@ -125,29 +126,31 @@ async def test_add_requirement_marker(mock_importlib, wheel_base):
125126
126127
127128@pytest .mark .asyncio
128- async def test_add_requirement_query_url (mock_importlib , wheel_base , monkeypatch ):
129+ async def test_add_requirement_query_url (
130+ mock_importlib , wheel_base , monkeypatch , host_compat_layer
131+ ):
129132 from micropip .transaction import Transaction
130133
131134 async def mock_add_wheel (self , wheel , extras , * , specifier = "" ):
132135 self .mock_wheel = wheel
133136
134137 monkeypatch .setattr (Transaction , "add_wheel" , mock_add_wheel )
135138
136- transaction = create_transaction (Transaction )
139+ transaction = create_transaction (Transaction , host_compat_layer )
137140 await transaction .add_requirement (f"{ SNOWBALL_WHEEL } ?b=1" )
138141 wheel = transaction .mock_wheel
139142 assert wheel .name == "snowballstemmer"
140143 assert wheel .filename == SNOWBALL_WHEEL # without the query params
141144
142145
143146@pytest .mark .asyncio
144- async def test_install_non_pure_python_wheel ():
147+ async def test_install_non_pure_python_wheel (host_compat_layer ):
145148 from micropip .transaction import Transaction
146149
147150 msg = "Wheel platform 'macosx_10_9_intel' is not compatible with Pyodide's platform"
148151 with pytest .raises (ValueError , match = msg ):
149152 url = "http://a/scikit_learn-0.22.2.post1-cp35-cp35m-macosx_10_9_intel.whl"
150- transaction = create_transaction (Transaction )
153+ transaction = create_transaction (Transaction , host_compat_layer )
151154 await transaction .add_requirement (url )
152155
153156
@@ -324,11 +327,12 @@ def test_last_version_and_best_tag_from_pypi(
324327 assert str (wheel .version ) == new_version
325328
326329
327- def test_search_pyodide_lock_first ():
330+ def test_search_pyodide_lock_first (host_compat_layer ):
328331 from micropip import package_index
329332 from micropip .transaction import Transaction
330333
331334 t = Transaction (
335+ _compat_layer = host_compat_layer ,
332336 ctx = {},
333337 ctx_extras = [],
334338 keep_going = True ,
@@ -341,6 +345,7 @@ def test_search_pyodide_lock_first():
341345 assert t .search_pyodide_lock_first is True
342346
343347 t = Transaction (
348+ _compat_layer = host_compat_layer ,
344349 ctx = {},
345350 ctx_extras = [],
346351 keep_going = True ,
@@ -355,7 +360,11 @@ def test_search_pyodide_lock_first():
355360
356361@pytest .mark .asyncio
357362async def test_index_url_priority (
358- mock_importlib , wheel_base , monkeypatch , mock_package_index_simple_json_api
363+ mock_importlib ,
364+ wheel_base ,
365+ monkeypatch ,
366+ mock_package_index_simple_json_api ,
367+ host_compat_layer ,
359368):
360369 # Test that if the index_urls are provided, package should be searched in
361370 # the index_urls first before searching in Pyodide lock file.
@@ -373,6 +382,7 @@ async def mock_add_wheel(self, wheel, extras, *, specifier=""):
373382 mock_index_url = mock_package_index_simple_json_api (pkgs = ["black" ])
374383
375384 t = Transaction (
385+ _compat_layer = host_compat_layer ,
376386 keep_going = True ,
377387 deps = False ,
378388 pre = False ,
0 commit comments