mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 06:52:56 +00:00
Add some typing to tests
This commit is contained in:
@@ -2,26 +2,28 @@
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from conftest import TrackedContainer
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
THIS_DIR = Path(__file__).absolute()
|
||||
|
||||
|
||||
def test_units(container):
|
||||
def test_units(container: TrackedContainer) -> None:
|
||||
"""Various units tests
|
||||
Add a py file in the {image}/test/units dir and it will be automatically tested
|
||||
"""
|
||||
short_image_name = container.image_name[container.image_name.rfind("/") + 1 :]
|
||||
host_data_dir = os.path.join(THIS_DIR, f"../{short_image_name}/test/units")
|
||||
host_data_dir = THIS_DIR / f"../{short_image_name}/test/units"
|
||||
LOGGER.info(f"Searching for units tests in {host_data_dir}")
|
||||
cont_data_dir = "/home/jovyan/data"
|
||||
|
||||
if not os.path.exists(host_data_dir):
|
||||
if not host_data_dir.exists():
|
||||
LOGGER.info(f"Not found unit tests for image: {container.image_name}")
|
||||
return
|
||||
|
||||
for test_file in os.listdir(host_data_dir):
|
||||
for test_file in host_data_dir.iterdir():
|
||||
LOGGER.info(f"Running unit test: {test_file}")
|
||||
|
||||
c = container.run(
|
||||
|
Reference in New Issue
Block a user