Point ``settings['assetdir']`` at a fresh per-test tempdir. Each test that writes a fixture file lands it under here, and asserts on what survives. ``Asset.objects.all().delete()`` clears DB rows between tests because ``django_db`` rollback covers persisted writes but the celery tas
(tmp_path: Any)
| 83 | |
| 84 | @pytest.fixture |
| 85 | def asset_dir(tmp_path: Any) -> Iterator[str]: |
| 86 | """Point ``settings['assetdir']`` at a fresh per-test tempdir. |
| 87 | |
| 88 | Each test that writes a fixture file lands it under here, and |
| 89 | asserts on what survives. ``Asset.objects.all().delete()`` clears |
| 90 | DB rows between tests because ``django_db`` rollback covers |
| 91 | persisted writes but the celery tasks above call |
| 92 | ``Asset.objects.update`` directly, which doesn't always observe |
| 93 | the wrap. |
| 94 | """ |
| 95 | Asset.objects.all().delete() |
| 96 | original = anthias_settings['assetdir'] |
| 97 | anthias_settings['assetdir'] = str(tmp_path) |
| 98 | try: |
| 99 | yield str(tmp_path) |
| 100 | finally: |
| 101 | anthias_settings['assetdir'] = original |
| 102 | Asset.objects.all().delete() |
| 103 | |
| 104 | |
| 105 | def _make_processing_asset( |