--- id: pytest-base-url version: "2.1.0" license: unclear license_treatment: copyleft maintenance: active --- # pytest-base-url — pytest plugin for URL based testing License: copyleft · Maintenance: active · Downloads: 10.2M/mo ## 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 above — verify before relying. A pytest plugin that injects a configurable base URL into your test suite via command line, config file, environment variable, or fixture override. 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 pip install pytest-base-url uv add pytest-base-url poetry add pytest-base-url ## Installing pytest-base-url 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. 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 Requires Python 3.8 or later (or PyPy3). The base_url fixture depends on pytest being installed. 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: not declared (copyleft) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 10.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest base url fixture, pytest url configuration plugin, pytest command line base url, pytest environment variable url, pytest test url management, pytest url testing helper, pytest base url override, pytest-plugin, integration-testing, url-management [View on SkillFed](https://skillfed.io/packages/pytest-base-url) · [View on PyPI](https://pypi.org/project/pytest-base-url/)