From 4f658454d7cbe65a076014aee21494edffd6a85a Mon Sep 17 00:00:00 2001 From: Dennis Mo Date: Thu, 30 Mar 2023 12:41:37 -0400 Subject: [PATCH] adding dockerfile and test for yourbase --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++ devscripts/test-yourbase.sh | 11 ++++++++++ test/__init__.py | 7 +++---- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 Dockerfile create mode 100755 devscripts/test-yourbase.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..3b745c1ea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +# Start from the yb_ubuntu:18.04 base image +FROM yourbase/yb_ubuntu:18.04 + + +# Update the package manager and install Python 3.9 +RUN apt-get update && \ + apt-get install -y python3.10 && \ + apt-get install -y git + +RUN which python3 + +# Set the default Python version to 3.10 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 + + +# Download the get-pip.py script and install pip +RUN curl https://bootstrap.pypa.io/pip/3.6/get-pip.py -o get-pip.py +RUN python3 get-pip.py + +# Verify that pip is installed +RUN pip --version + +RUN pip install yourbase + +RUN pip install nose + +RUN pip install pytest + +ENV YTDL_TEST_SET core + +# Copy the repository into the container +COPY . /app + +# Set the working directory to the app directory +WORKDIR /app + +# Install any dependencies required by the repository using pip +# RUN python3 -m pip install -r requirements.txt + +# Run any necessary setup commands for the repository +CMD ["./devscripts/test-yourbase.sh"] \ No newline at end of file diff --git a/devscripts/test-yourbase.sh b/devscripts/test-yourbase.sh new file mode 100755 index 000000000..750992d91 --- /dev/null +++ b/devscripts/test-yourbase.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Only run in docker container +# Run initial test with nosetest and yourbase +/app/devscripts/run_tests.sh + +# Edit some files +echo "print('Hello World')" >> youtube_dl/extractor/buzzfeed.py + +# Run test again +/app/devscripts/run_tests.sh diff --git a/test/__init__.py b/test/__init__.py index d3bcf077c..fb3715b56 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -7,8 +7,7 @@ import platform print("davi logs", sys.version[0:3]) print("davi logs", platform.python_implementation()) -if sys.version[0:3] == '3.9': - import unittest - import yourbase +import unittest +import yourbase - yourbase.attach(unittest) +yourbase.attach(unittest)