-
Couldn't load subscription status.
- Fork 359
Description
Bug Report
May be related to #1586. Uncovered by pyright.
TextureCache does this:
arcade/arcade/cache/texture.py
Lines 94 to 97 in 37ba31f
| if self._strong_file_entries.get(file_path): | |
| raise ValueError(f"File path {file_path} already in cache") | |
| if file_path: | |
| self._strong_file_entries.put(str(file_path), texture) |
Except that file_path is an instance of Path. This means the if will always fail and that exception will never throw.
I think the tests are relying on this behavior since they load the same texture multiple times:
arcade/tests/unit/cache/test_hit_box_cache.py
Lines 73 to 84 in 37ba31f
| file = ":resources:images/space_shooter/playerShip1_orange.png" | |
| # We don't cache hit boxes with no algo | |
| texture = load_texture(file, hit_box_algorithm=hitbox.algo_bounding_box) | |
| assert arcade.cache.hit_box_cache.get(texture.cache_name) is None | |
| assert len(arcade.cache.hit_box_cache) == 0 | |
| # We cache hit boxes with an algo | |
| texture_1 = load_texture(file, hit_box_algorithm=hitbox.algo_simple) | |
| texture_2 = load_texture(file, hit_box_algorithm=hitbox.algo_detailed) | |
| assert len(arcade.cache.texture_cache) == 3 | |
| assert len(arcade.cache.hit_box_cache) == 2 |
I can include a fix as part of my work on #1751, but I'm not sure what the fix should be: throw the exception? Silently allow the same entry to be put in cache multiple times?