Skip to main content

pytest-simplehttpserver

Simple fixture to spin up a simple HTTP server to serve static files for testing.

Can be used for testing web scrapers, etc.

Features

  • The fixture spins up a HTTP server that serves static files on port 8000.

Usage

When running your tests you need to point pytest-simplehttpserver to root directory with the static files you want to serve:

$ pytest --simplehttpserver-directory /home/user/mock_website/

In your code, just pass the fixture to your tests:

import requests

def mytest(simplehttpserver):
    response = requests.get('http://localhost:8000/')
    assert response.status_code == 200

Installation

You can install "pytest-simplehttpserver" via pip from PyPI:

$ pip install pytest-simplehttpserver

Contributing

Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, "pytest-simplehttpserver" is free and open source software

Release files for pytest-simplehttpserver 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-simplehttpserver 0.1.2
File Size Uploaded
pytest_simplehttpserver-0.1.2.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-simplehttpserver 0.1.2
File Interpreter ABI Platform
pytest_simplehttpserver-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / pytest_simplehttpserver-0.1.2.tar.gz

Download URL pytest_simplehttpserver-0.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bb749abee8b224a910b87af33d0c815f3b4f350137841c851634c617cc1b0516
BLAKE2b-256 checksum
How to use checksums
bfe35f79d269a969e7ba657a09aea391c6b973a52d0263035f64843f7deb283b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

Release files / pytest_simplehttpserver-0.1.2-py3-none-any.whl

Download URL pytest_simplehttpserver-0.1.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6eff57e2d57a64db0269b939a34bdf97dcd6321b418af761ea5f9685fffd61a
BLAKE2b-256 checksum
How to use checksums
a291c765cae8581a9ccb4d60c645c5ec7c305e033b9e4dac1e405d2cdfa03c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page