Skip to content

Commit

Permalink
use SimpleNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Feb 10, 2022
1 parent 9616e78 commit 35b9003
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/test_asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import stat
import tempfile
from types import SimpleNamespace

import pytest

Expand All @@ -26,13 +27,6 @@ def loop():
return asyncio.get_event_loop()


class MockStat:
def __init__(self, st_mode, st_size, st_mtime):
self.st_mode = st_mode
self.st_size = st_size
self.st_mtime = st_mtime


@pytest.fixture()
def static_file_sample():
content = b"01234567890123456789"
Expand All @@ -43,8 +37,8 @@ def static_file_sample():
temporary_file.write(content)
temporary_file.close()
stat_cache = {
temporary_file.name: MockStat(
stat.S_IFREG, len(content), modification_epoch
temporary_file.name: SimpleNamespace(
st_mode=stat.S_IFREG, st_size=len(content), st_mtime=modification_epoch
)
}
static_file = StaticFile(temporary_file.name, [], stat_cache=stat_cache)
Expand Down

0 comments on commit 35b9003

Please sign in to comment.