Skip to content

Commit 4008c1d

Browse files
committed
Fix up static dir stuff
1 parent 04e8fb9 commit 4008c1d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

volt/app_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from contextlib import asynccontextmanager
33
import logging
44
from pathlib import Path
5+
import shutil
56
import threading
67
from http import HTTPStatus, cookies as HTTPCookies
78

@@ -309,12 +310,16 @@ def styles_css_file() -> Generator[None]:
309310
"""
310311
path = Path(__file__).parent
311312
static_dir = path / "static"
313+
static_dir.mkdir()
314+
312315
styles_file = static_dir / "styles.css"
313316
_ = styles_file.write_text(css_content, encoding="utf-8")
314317

315318
app.static_location = "volt/static"
319+
316320
yield
317-
styles_file.unlink()
321+
322+
shutil.rmtree(static_dir)
318323
app.static_location = None
319324

320325

@@ -345,7 +350,7 @@ async def callback():
345350
log.debug("callback called!")
346351
started.set()
347352

348-
app = Volt(static_location="volt/static", lifespan=dummy_lifespan)
353+
app = Volt(lifespan=dummy_lifespan)
349354

350355
config = uvicorn.Config(app, port=9999, callback_notify=callback)
351356
server = uvicorn.Server(config)

0 commit comments

Comments
 (0)