mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-11 12:02:56 +00:00

* Create base-jupyter from base-notebook for non-server jupyter applications * Fix pre-commit errors and begin test refactoring * More test refactoring * Add base-jupyter to images_hierarchy * Use folder work instead of .jupyter in nb-user test * Add base-jupyter to tagging hierarchy * Linting: trailing comma * Apply review comments, remove obsolute Miniforge reference * Add self-signed cert comment back to base-notebook doc * Update docs/using/selecting.md Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com> * Remove redundant apt-get upgrade per review * Remove b/c approaches per review * Move test_nb_user_change back to base-notebook tests, per review * fix linting * Rename base-jupyter to docker-stacks-foundation, per review * Rename tests/base-jupyter to docker-stacks-foundation * Use alphabetical order * Use alphabetical order * Fix markdown style * Split test_nb_user_change between the foundation and base tests Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
|
|
import logging
|
|
|
|
from tests.conftest import TrackedContainer
|
|
from tests.images_hierarchy import get_test_dirs
|
|
|
|
LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
def test_units(container: TrackedContainer) -> None:
|
|
"""Various units tests
|
|
Add a py file in the `tests/{somestack}-notebook/units` dir, and it will be automatically tested
|
|
"""
|
|
short_image_name = container.image_name[container.image_name.rfind("/") + 1 :]
|
|
LOGGER.info(f"Running unit tests for: {short_image_name}")
|
|
|
|
test_dirs = get_test_dirs(short_image_name)
|
|
|
|
for test_dir in test_dirs:
|
|
host_data_dir = test_dir / "units"
|
|
LOGGER.info(f"Searching for units tests in {host_data_dir}")
|
|
cont_data_dir = "/home/jovyan/data"
|
|
|
|
if not host_data_dir.exists():
|
|
LOGGER.info(f"Not found unit tests for image: {container.image_name}")
|
|
continue
|
|
|
|
for test_file in host_data_dir.iterdir():
|
|
test_file_name = test_file.name
|
|
LOGGER.info(f"Running unit test: {test_file_name}")
|
|
|
|
container.run_and_wait(
|
|
timeout=30,
|
|
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
|
|
tty=True,
|
|
command=["start.sh", "python", f"{cont_data_dir}/{test_file_name}"],
|
|
)
|