Skip to content

Commit 6f590be

Browse files
Merge pull request #190 from dmb225/feature/pytest-warnings
fix: Fix all pytest warnings
2 parents 6d804dd + 32e49ca commit 6f590be

27 files changed

Lines changed: 82 additions & 72 deletions

examples/auth_router.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from nexios import get_application
1+
from nexios import NexiosApp
22
from nexios.routing import Router
33

44
auth_router = Router()
@@ -16,7 +16,7 @@ async def login(req, res):
1616
return res.json({"error": "Invalid credentials"}, status_code=401)
1717

1818

19-
app = get_application()
19+
app = NexiosApp()
2020
app.mount_router("/auth", auth_router)
2121

2222
if __name__ == "__main__":

examples/basic_rest_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from nexios import get_application
1+
from nexios import NexiosApp
22

3-
app = get_application()
3+
app = NexiosApp()
44

55

66
@app.get("/api/items")

examples/file_router/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
BASE_DIR = Path(__file__).parent.parent.parent
77
sys.path.append(str(BASE_DIR))
88

9-
from nexios import get_application
9+
from nexios import NexiosApp
1010
from nexios.file_router import FileRouter
1111

12-
app = get_application()
12+
app = NexiosApp()
1313

1414
FileRouter(app, config={"root": "./routes", "exempt_paths": ["./routes/posts"]})
1515

examples/file_upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from nexios import get_application
1+
from nexios import NexiosApp
22

3-
app = get_application()
3+
app = NexiosApp()
44

55

66
@app.post("/upload")

examples/form_data_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from pydantic import BaseModel, EmailStr, ValidationError
22

3-
from nexios import get_application
3+
from nexios import NexiosApp
44

5-
app = get_application()
5+
app = NexiosApp()
66

77

88
class UserRegistration(BaseModel):

examples/lifespan_example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import logging
1515
from contextlib import asynccontextmanager
1616

17-
from nexios import get_application
17+
from nexios import NexiosApp
1818
from nexios.http.request import Request
1919
from nexios.http.response import Response
2020

@@ -98,7 +98,7 @@ async def lifespan_context(app):
9898
# Create application instances to demonstrate different approaches
9999

100100
# 1. Application with regular startup/shutdown handlers
101-
regular_app = get_application(title="Regular Handlers Example")
101+
regular_app = NexiosApp(title="Regular Handlers Example")
102102

103103

104104
@regular_app.on_startup()
@@ -130,11 +130,11 @@ async def shutdown_handler2():
130130

131131

132132
# 2. Application with custom lifespan context manager
133-
custom_app = get_application(title="Custom Lifespan Example", lifespan=lifespan_context)
133+
custom_app = NexiosApp(title="Custom Lifespan Example", lifespan=lifespan_context)
134134

135135

136136
# 3. Application demonstrating error handling
137-
error_app = get_application(title="Error Handling Example")
137+
error_app = NexiosApp(title="Error Handling Example")
138138

139139

140140
@error_app.on_startup()
@@ -153,7 +153,7 @@ async def error_cleanup():
153153

154154

155155
# Main application that combines regular handlers and custom lifespan
156-
app = get_application(title="Nexios Lifespan Demo", lifespan=lifespan_context)
156+
app = NexiosApp(title="Nexios Lifespan Demo", lifespan=lifespan_context)
157157

158158

159159
# Add some regular handlers too (these won't run when custom lifespan is used)

examples/streaming_middleware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from nexios import get_application
1+
from nexios import NexiosApp
22

3-
app = get_application()
3+
app = NexiosApp()
44

55

66
async def log_request(req, res, next):

nexios/templates/beta/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from nexios import get_application
1+
from nexios import NexiosApp
22
from nexios.routing import Routes
33

44
from config import app_config
55
from routes.index import index
66

77
# Create the application
8-
app = get_application(title="{{project_name_title}}", config=app_config)
8+
app = NexiosApp(title="{{project_name_title}}", config=app_config)
99

1010

1111
@app.on_startup

nexios/testing/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515

1616
class Client(httpx.AsyncClient):
17+
__test__ = False
18+
1719
def __init__(
1820
self,
1921
app: "NexiosApp",
@@ -76,6 +78,9 @@ async def handle_request(
7678
] = httpx._client.USE_CLIENT_DEFAULT, # type: ignore
7779
extensions: Union[Dict[str, typing.Any], None] = None,
7880
) -> httpx.Response:
81+
if cookies:
82+
self.cookies.update(cookies)
83+
7984
response = await super().request(
8085
method,
8186
url,
@@ -85,7 +90,6 @@ async def handle_request(
8590
json=json,
8691
params=params,
8792
headers=headers,
88-
cookies=cookies,
8993
auth=auth,
9094
follow_redirects=follow_redirects,
9195
timeout=timeout,
@@ -154,7 +158,6 @@ async def post(
154158
json=json,
155159
params=params,
156160
headers=headers,
157-
cookies=cookies,
158161
auth=auth,
159162
follow_redirects=follow_redirects,
160163
timeout=timeout,

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ nexios = "nexios.cli:cli"
9393

9494
[tool.pytest.ini_options]
9595
asyncio_mode = "auto"
96-
asyncio_fixture_scope = "function"
9796
addopts = "--ignore=benchmarks"
9897

9998
[tool.mypy]

0 commit comments

Comments
 (0)