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

Download files

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

Source Distribution

pytest_simplehttpserver-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

pytest_simplehttpserver-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_simplehttpserver-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_simplehttpserver-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using 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.0 CPython/3.8.5

File hashes

Hashes for pytest_simplehttpserver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df69999f5b4aa2e5792ed0e83c32d5f7052e5be675777dbbb5a4f5ca83a8fba5
MD5 f59067bc37af5025460fe543a9190078
BLAKE2b-256 a3dd2c8855ccd2081194a69cf09945e6b42143dff82ac58cbe7de1c728fdbefb

See more details on using hashes here.

File details

Details for the file pytest_simplehttpserver-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_simplehttpserver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using 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.0 CPython/3.8.5

File hashes

Hashes for pytest_simplehttpserver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbc6d56629b9d06f82762388f2653112bbb4ed81d85bd045083a30c8b9755d0c
MD5 8b4cb65d5209f95f8a97b580220088dc
BLAKE2b-256 a3ddafb62be3920dcde166d8fd062a26374a598ead711d32371f8e58f3641713

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 Sentry Error logging StatusPage Status page