Skip to main content

No project description provided

Project description

Documentation Status

ci Codecov

PyPi PyPI Python versions License

pytest integration for


from PyPi

pip install pytest-ngrok

or from git

pip install -e git+


import pytest

from urllib.error import HTTPError
from urllib.request import urlopen

def test_ngrok(ngrok, httpserver):
    remote_url = ngrok(httpserver.port)
    assert urlopen(remote_url + "/foobar").read() == b'ok'

def test_ngrok_context_manager(ngrok, httpserver):
    # example local server
    with ngrok(httpserver.port) as remote_url:
        _test_url = str(remote_url) + '/foobar'
        assert urlopen(_test_url).read() == b'ok'

    # Connection closes
    pytest.raises(HTTPError, urlopen, _test_url)

With pytest-django can use fixture live_server_ngrok

def test_server(live_server_ngrok):
    assert live_server_ngrok.url.endswith('')



python -m venv /tmp/.venv/pytest-ngrok
source /tmp/.venv/pytest-ngrok/activate
pip install -r requirements-dev.txt

Run tests


Update version

python bumpversion

Publish pypi

python publish

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

pytest-ngrok-0.0.4.tar.gz (6.0 kB view hashes)

Uploaded source

Built Distribution

pytest_ngrok-0.0.4-py2.py3-none-any.whl (6.9 kB view hashes)

Uploaded py2 py3

Supported by

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