The Scope Python agent is compatible with the following versions of Python:
The Scope Python agent is compatible with the following libraries:
Do you use a python version or library not listed here? Please let us know!
Installation of the Scope Agent is done via pip.
pip install scopeagent
To use the agent, prefix your test or startup command with
scope-run. For example:
scope-run python -m unittest discover # to run tests scope-run gunicorn myapp.wsgi # if instrumenting dependent services in integration tests
As an alternative, you can also install the agent in your application's code, as early in the execution as possible:
import scopeagent agent = scopeagent.Agent(api_key="xxxxxxxx", api_endpoint="https://scope.mycompany.corp") agent.install()
After this, you can run your tests as you normally do, for example using
python -m unittest commands.
In order to use the
scope-run CLI with
tox, make sure you prefix your
testing command inside your
tox.ini file, instead of the
tox command itself.
# content of: tox.ini , put in same dir as setup.py [tox] envlist = py27,py36 [testenv] # install pytest in the virtualenv where commands will be executed deps = pytest commands = scope-run pytest
And then, run
tox as usual.
CI provider configuration
The following environment variables (or parameters passed to
scope-run) need to be configured in your CI provider:
|API key to use when sending data to Scope|
|API endpoint of the Scope installation to send data to|
The following optional parameters can also be configured:
|Service name to use when sending data to Scope|
|Autodetected||Commit hash to use when sending data to Scope|
|Autodetected||Repository URL to use when sending data to Scope|
|Autodetected||Repository root path|
Autodetection of git information works if either tests run on Jenkins,
CircleCI, Travis CI or GitLab CI,
or if the
.git folder is present locally, and there is an
origin remote configured pointing to the right repository.
These configuration settings can also be provided via CLI flags. Run
scope-run --help for more information.