Skip to main content

Pytest plugin for E2E testing of jupyter-deploy templates

Project description

pytest-jupyter-deploy

Pytest plugin for E2E testing of jupyter-deploy templates.

Overview

This package provides pytest fixtures and utilities for writing end-to-end tests for jupyter-deploy templates. It handles deployment lifecycle management, configuration loading, and provides helpers for testing web applications with Playwright.

Installation

pip install pytest-jupyter-deploy

For UI testing with Playwright:

pip install pytest-jupyter-deploy[ui]
playwright install firefox

Fixtures

  • e2e_deployment (session-scoped): Manages deployment lifecycle (init, config, up, down)
  • e2e_config (session-scoped): Provides access to suite configuration
  • e2e_suite_dir (session-scoped): Path to the E2E tests directory
  • github_oauth_app (function-scoped): Helper for GitHub OAuth2 Proxy authentication with passkey support

Usage

The plugin is automatically loaded by pytest when installed. Use the provided fixtures in your tests.

Example Test

from pytest_jupyter_deploy.deployment import EndToEndDeployment

def test_host_running(e2e_deployment: EndToEndDeployment) -> None:
    """Test that the host is running."""
    e2e_deployment.ensure_deployed()
    host_status = e2e_deployment.cli.get_host_status()
    assert host_status == "running"

Running Tests

# Run E2E tests
pytest -m e2e

# Run against existing deployment
pytest -m e2e --e2e-existing-project=sandbox3

# Capture screenshots on failure
pytest -m e2e --screenshot only-on-failure

Test Utilities

The plugin provides helper functions to use directly in your tests.

Deployment helpers

from pytest_jupyter_deploy.undeployed_project import undeployed_project

def test_init_project(e2e_config: SuiteConfig) -> None:
    with undeployed_project(e2e_config) as (project_dir, cli):
        result = cli.run_command("show --variables --list")
        assert result.returncode == 0

Decorators

from pytest_jupyter_deploy.plugin import skip_if_testvars_not_set

@skip_if_testvars_not_set(["JD_E2E_USER", "JD_E2E_ORG"])
def test_requires_env_vars(e2e_deployment: EndToEndDeployment) -> None:
    ...

E2E Test Container Image

This package bundles a Dockerfile and docker-compose.yml for a containerized E2E test environment with Python, Terraform, AWS CLI, and Playwright pre-installed. The image is template-independent and used by the jupyter-deploy justfile to run E2E tests locally.

from pytest_jupyter_deploy.image import IMAGE_PATH
# IMAGE_PATH points to the directory containing Dockerfile and docker-compose.yml

License

The Pytest plugin for Jupyter Deploy templates is licensed under the MIT License.

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_jupyter_deploy-0.2.4.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

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

pytest_jupyter_deploy-0.2.4-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_jupyter_deploy-0.2.4.tar.gz.

File metadata

  • Download URL: pytest_jupyter_deploy-0.2.4.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_jupyter_deploy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 52f647d1bfee8228dea86c186f3afe65b28a029943e4d8058fbfb545be4366da
MD5 e6ce4d475b4a6c8d299c90fbfc259d33
BLAKE2b-256 84e478cf55b7f1f1417276affd6b2aaee640294a9f08fc9a9123e2e0f5608c0b

See more details on using hashes here.

File details

Details for the file pytest_jupyter_deploy-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pytest_jupyter_deploy-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pytest_jupyter_deploy-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 37155600fd6141f8291ef731259c3aabe9674e9d321c93d39edf031412ed3d4f
MD5 22532b9cdcb28c730efb21e4a2915da8
BLAKE2b-256 cfeb39162dc8089cc75a24c247c96276cfc5433fd316bdc6bb6e74c85171c7d3

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