Skip to content

test: add remaining coverage - #500

Merged
miketheman merged 6 commits into
mainfrom
improve-tests
Jun 28, 2026
Merged

miketheman merged 6 commits into
mainfrom
improve-tests

Conversation

@miketheman

Copy link
Copy Markdown
Owner

Cover all behaviors, add mutation testing, close out some other untested behaviors

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).
@codspeed

codspeed Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing improve-tests (c36a6d7) with main (ef6be18)

Open in CodSpeed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread pyproject.toml Resolved
@miketheman
miketheman merged commit 4fa5b7c into main Jun 28, 2026
30 checks passed
@miketheman
miketheman deleted the improve-tests branch June 28, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants