← Winnitude! Search  ·  Reader Mode (1074 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 57 LINKS

GitHub - keploy/python-sdk

Repository navigation

python-sdk
Public

About

No description, website, or topics provided.

Resources

Readme Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

13 stars

Watchers

1 watching

Forks

9 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


31 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.github .github    
keploy-pytest keploy-pytest    
scripts scripts    
src/ keploy_agent src/ keploy_agent    
tests tests    
.gitignore .gitignore    
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md    
CONTRIBUTING.md CONTRIBUTING.md    
LICENSE LICENSE    
MANIFEST.in MANIFEST.in    
README.md README.md    
SECURITY.md SECURITY.md    
pyproject.toml pyproject.toml    
requirements.txt requirements.txt    

Repository files navigation

Keploy Python Coverage Agent

The Keploy Python Coverage Agent is a lightweight, sidecar module designed to integrate with the Keploy integration testing platform (enterprise version). When imported into a Python application, it enables Keploy to capture and report code coverage on a per-test-case basis.

Installation and Usage

Follow these steps to integrate the coverage agent into your Python project.

Step 1: Install the Agent

Install the keploy-agent package from PyPI into your virtual environment:

pip install keploy-agent

If you are developing the agent, install it in editable mode from a checkout of this repository instead:

pip install -e /path/to/python-sdk

Step 2: Integrate into Your Application

To enable coverage tracking, import the keploy_agent module at the very top of your application's main entry point file (e.g., app.py, main.py).

It is crucial that this is one of the first imports, as this ensures the agent is initialized before your application code begins to execute.

Example app.py:

import keploy_agent  # <-- Add this line at the top
import os
from flask import Flask

app = Flask(__name__)

@app.get("/")
def hello():
    # This function will be tracked by the coverage agent
    # when its endpoint is hit during a Keploy test.
    return "Hello, World!"

if __name__ == "__main__":
    app.run()

Step 3: Run with Keploy

Now, you can run your application tests using the Keploy CLI. The agent will automatically connect with Keploy.

sudo -E keploy-enterprise test -c "python3 app.py" --language python --dedup

Now you will see dedupData.yaml getting created.

Run sudo -E keploy-enterprise dedup to get the tests which are duplicate in duplicates.yaml file

In order to remove the duplicate tests, run the following command:

sudo -E keploy-enterprise dedup --rm

About

No description, website, or topics provided.

Resources

Readme Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy Activity Custom properties

Stars

13 stars

Watchers

1 watching

Forks

9 forks Report repository

Releases

Packages

Used by

Contributors

Languages

Generated from keploy/template