Skip to main content

Ensures generated code does no more than your spec demands.

Project description

specfence

Detects code your tests don't demand. Replaces each statement with pass and runs your tests — if they still pass, that line is outside the fence.

Installation

uv tool install specfence

Usage

specfence <file> <test_file>

Run from the directory where your imports resolve (i.e. the project root):

cd my_project
specfence app.py test_app.py

Example

The example/ directory contains a sample module and test file:

cd example
specfence app.py test_app.py

Output:

EXCESS  app.py:7   logger.info("Processing order %s", order_id)
EXCESS  app.py:8   print(f"Starting order {order_id}")
EXCESS  app.py:17   logger.debug("Order %s total: %s", order_id, grand_total)
EXCESS  app.py:18   print(f"Order complete: ${grand_total:.2f}")

4 fence violations — delete these lines, they do not change any observed behavior

These lines can be deleted without breaking any test.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

specfence-0.0.5.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

specfence-0.0.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file specfence-0.0.5.tar.gz.

File metadata

  • Download URL: specfence-0.0.5.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for specfence-0.0.5.tar.gz
Algorithm Hash digest
SHA256 c0b1f51cdf988251794f511bf831cd4b8a98a341501abf7273247ba1384967de
MD5 bb8f00210459e99f7f3a965f06e4f5ea
BLAKE2b-256 f493abd4097952a5fd485d213e39979aeb4a6b80b2d3ff6ed99bad2dde173953

See more details on using hashes here.

File details

Details for the file specfence-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: specfence-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for specfence-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c54b75e594d0bb0899533a9d6cfe4b4a97c30d1a665af5a291750c2e8fddf870
MD5 40c5cf44df7fc1fab746b9a38bda7d00
BLAKE2b-256 97724d5cf3f400abdb300c7a864ae15c4ec8cb0a87221da5466b06d955d0a8ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page