Repository navigation
test: add remaining coverage - #500
Merged
Merged
Conversation
Signed-off-by: Mike Fiedler <[email protected]>
Signed-off-by: Mike Fiedler <[email protected]>
Run `make mutmut` to analyze and run. Currently 52 mutants survive. Signed-off-by: Mike Fiedler <[email protected]>
argparse derives these dest names from the option strings, so the explicit values just repeated the defaults.
Add tests for the disable/allow-unix defaults, CIDR entries with host bits, DNS restoration on enable and teardown, the allow-unix non-bypass, the socket_disabled fixture guarding sibling fixtures during setup, and the option and marker help text.
Skip the equivalent and cosmetic mutants with do_not_mutate_patterns, and fail the mutmut target on any non-killed mutant except segfaults (mutating the plugin's own pytest hooks crashes the inner pytest, so those can't be killed by a test).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands test coverage for pytest-socket, adds mutation testing support via mutmut, and updates project configuration/dependencies to support the new tooling.
Changes:
- Add tests covering additional socket-blocking behaviors (Unix sockets, DNS restoration, marker/config interactions).
- Introduce
mutmut(pinned to an unreleased fix) plus Makefile automation and ignores for its artifacts. - Update CLI/marker help-message expectations and refresh the dependency lock.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Adds locked dependencies for mutmut and its transitive requirements; updates resolution markers. |
tests/test_socket.py |
Adds new unit/integration tests for pytest_runtest_setup, host_from_address, Unix-socket behavior, and fixture ordering effects. |
tests/test_restrict_hosts.py |
Adds tests around CIDR parsing leniency, Unix-socket vs allow-hosts interactions, and error-message formatting. |
tests/test_dns.py |
Adds tests ensuring DNS functions are restored both within a test and across tests via teardown. |
src/pytest_socket/__init__.py |
Simplifies pytest_addoption by removing explicit dest= assignments (behavior otherwise unchanged). |
pyproject.toml |
Adds mutmut pin + configuration; attempts to add pytest addopts to ignore mutants/. |
Makefile |
Adds a mutmut target that runs mutation testing and fails on non-killed mutants (except segfaults). |
.gitignore |
Ignores mutmut artifacts (mutants/, .mutmut-cache). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cover all behaviors, add mutation testing, close out some other untested behaviors