Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve logging test and increase coverage on server.py #1743

Merged
merged 24 commits into from Nov 2, 2022
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions uvicorn/server.py
Expand Up @@ -120,7 +120,7 @@ def _share_socket(sock: socket.SocketType) -> socket.SocketType:
self.servers.append(server)
listeners = sockets

elif config.fd is not None:
elif config.fd is not None: # pragma: py-win32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add # pragma: py-win32 because we use socket.AF_UNIX in all instances.

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you mean in the line after... Got it. Yep!

# Use an existing socket, from a file descriptor.
sock = socket.fromfd(config.fd, socket.AF_UNIX, socket.SOCK_STREAM)
server = await loop.create_server(
Expand All @@ -130,7 +130,7 @@ def _share_socket(sock: socket.SocketType) -> socket.SocketType:
listeners = server.sockets
self.servers = [server]

elif config.uds is not None:
elif config.uds is not None: # pragma: py-win32
# Create a socket using UNIX domain socket.
uds_perms = 0o666
if os.path.exists(config.uds):
Expand Down