pytest-base-url
pytest plugin for URL based testing
Decision gist · record as of 2026-08-14
Yes. This is a mature, actively maintained plugin (Production/Stable status, last release January 2024) with minimal dependencies and low install friction. It solves a common testing problem elegantly and has no known vulnerabilities. The copyleft license (MPL 2.0) is permissive for most use cases. Install it if your test suite makes HTTP requests to configurable endpoints.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later (or PyPy3).
- The base_url fixture depends on pytest being installed.
- Low friction: pure Python wheel with only pytest and requests as runtime dependencies.
License · maintenance · safety
copyleft license (copyleft) — Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You may use and modify the package freely, but derivative works must be distributed under the same license terms.
last release 2024-01-31 (926 days) · last repo commit 2026-05-25 · 39 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 10,189,946 downloads/mo, #1,473 on PyPI
Alternatives
Verify before relying
pip install pytest-base-url
# In your test file:
def test_example(base_url):
import requests
response = requests.get(base_url)
assert response.status_code == 200
# Run with: pytest --base-url http://example.com- Whether the package handles URL validation or normalization beyond what the description states
- Performance impact of base URL verification with --verify-base-url on large test suites
- Compatibility details with pytest versions beyond the classifiers listed
What it is and what it does
pytest-base-url is a lightweight pytest plugin that centralizes base URL management for test suites that make HTTP requests. Instead of hardcoding or repeating URLs across tests, you specify a single base URL once—via command line (--base-url), configuration file, environment variable (PYTEST_BASE_URL), or by overriding the base_url fixture—and inject it into any test that needs it. The plugin is commonly used in integration and end-to-end testing workflows where tests need to target different environments (dev, staging, production) without code changes.
The package depends only on pytest and requests, making installation frictionless. It supports Python 3.8 and later on CPython and PyPy, and is actively maintained. An optional --verify-base-url flag lets you fail fast if the target URL is unreachable before running the full suite, and you can conditionally skip tests based on the base URL value.
Use it for
- Integration testing against multiple environments by passing different base URLs without changing test code
- End-to-end testing of web applications where the server URL is determined at runtime by a fixture
- CI/CD pipelines that run the same test suite against dev, staging, and production with environment-specific URLs
- Skipping environment-specific tests (e.g., skip search tests on dev) based on the base URL provided
- Verifying that a target URL is reachable before running a large test suite to fail fast on connectivity issues
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
This is a mature, actively maintained plugin (Production/Stable status, last release January 2024) with minimal dependencies and low install friction. It solves a common testing problem elegantly and has no known vulnerabilities. The copyleft license (MPL 2.0) is permissive for most use cases. Install it if your test suite makes HTTP requests to configurable endpoints.
Install
pytest-base-url on PyPI
Before you install
Low friction: pure Python wheel with only pytest and requests as runtime dependencies. Actively maintained with recent commits; last release was January 2024.
Requires Python 3.8 or later (or PyPy3). The base_url fixture depends on pytest being installed.
License in practice
Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license. You may use and modify the package freely, but derivative works must be distributed under the same license terms.
Quickstart
pip install pytest-base-url
# In your test file:
def test_example(base_url):
import requests
response = requests.get(base_url)
assert response.status_code == 200
# Run with: pytest --base-url http://example.com
Verify before relying
- Whether the package handles URL validation or normalization beyond what the description states
- Performance impact of base URL verification with --verify-base-url on large test suites
- Compatibility details with pytest versions beyond the classifiers listed
Package facts
| License | copyleft license copyleft |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytestrequests |
| Maintenance | Actively maintained 926 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,189,946 / month, #1,473 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Natural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: Utilities |
Evidence: pytest_base_url-2.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytest base url fixture”
- pytest-base-urlA pytest plugin that injects a configurable base URL into your test…
- pytest-httpx2A pytest plugin that mocks httpx2 HTTP requests using respx, letting…
- pytest-fixture-configProvides configuration objects and decorators for pytest fixtures…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also pytest-metadata · pytest-selenium · pytest-httpbin · pytest-django · pytest-postgresql · pytest-localserver · pytest-spark · pytest-html · pytest-sftpserver · pytest-loguru