diff options
| author | Maurits van Rees <maurits@vanrees.org> | 2023-03-07 22:36:16 +0100 |
|---|---|---|
| committer | Maurits van Rees <maurits@vanrees.org> | 2023-03-07 22:43:50 +0100 |
| commit | 8af6bd4818558e4e4427e730ede8bc7ba17ca000 (patch) | |
| tree | c7c0a356fea1919b544c22d50accc815be1db857 /setuptools/tests | |
| parent | 2c234499777a5d3f5a213fbfc42b289c207c411b (diff) | |
| download | python-setuptools-git-8af6bd4818558e4e4427e730ede8bc7ba17ca000.tar.gz | |
Use functools.lru_cache to cache supported tags for wheels.
This is a suggestion by @abravalheri for my PR.
https://github.com/pypa/setuptools/pull/3805#issuecomment-1434361907
Diffstat (limited to 'setuptools/tests')
| -rw-r--r-- | setuptools/tests/test_wheel.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py index 8b2faff6..934cf7f3 100644 --- a/setuptools/tests/test_wheel.py +++ b/setuptools/tests/test_wheel.py @@ -612,9 +612,17 @@ def test_wheel_is_compatible(monkeypatch): for t in parse_tag('cp36-cp36m-manylinux1_x86_64'): yield t monkeypatch.setattr('setuptools.wheel.sys_tags', sys_tags) - monkeypatch.setattr('setuptools.wheel._supported_tags', None) - assert Wheel( - 'onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible() + # Clear the supported tags cache, otherwise the sys_tags monkeypatch + # has no effect. + setuptools.wheel._supported_tags.cache_clear() + try: + assert Wheel( + 'onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl' + ).is_compatible() + finally: + # Clear the cache again, otherwise the sys_tags monkeypatch + # is still in effect for the rest of the tests. + setuptools.wheel._supported_tags.cache_clear() def test_wheel_mode(): |
