diff --git a/test/test_artifacts/v2/fastapi.test.Dockerfile b/test/test_artifacts/v2/fastapi.test.Dockerfile new file mode 100644 index 00000000..5a54c11b --- /dev/null +++ b/test/test_artifacts/v2/fastapi.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/fastapi/fastapi + +WORKDIR "fastapi" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_fastapi_tests.sh . + +RUN chmod +x run_fastapi_tests.sh + +CMD ["./run_fastapi_tests.sh"] + diff --git a/test/test_artifacts/v2/ipywidgets.test.Dockerfile b/test/test_artifacts/v2/ipywidgets.test.Dockerfile new file mode 100644 index 00000000..c2d3235a --- /dev/null +++ b/test/test_artifacts/v2/ipywidgets.test.Dockerfile @@ -0,0 +1,20 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone https://github.com/jupyter-widgets/ipywidgets.git + +WORKDIR "ipywidgets" + +RUN pip install jupyter nbconvert + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_ipywidgets_tests.sh ./ +RUN chmod +x run_ipywidgets_tests.sh + +CMD ["./run_ipywidgets_tests.sh"] diff --git a/test/test_artifacts/v2/jinja2.test.Dockerfile b/test/test_artifacts/v2/jinja2.test.Dockerfile new file mode 100644 index 00000000..be28d8f0 --- /dev/null +++ b/test/test_artifacts/v2/jinja2.test.Dockerfile @@ -0,0 +1,14 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y -c conda-forge jinja2 + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jinja2_tests.sh ./ + +RUN chmod +x run_jinja2_tests.sh + +CMD ["./run_jinja2_tests.sh"] diff --git a/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile b/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile index 0b005de1..a4ed91e4 100644 --- a/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile +++ b/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile @@ -3,4 +3,15 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyter_collaboration; import jupyter_server_fileid; from jupyter_ydoc import YBlob; yblob = YBlob(); assert yblob.get() == b''; yblob.set(b'012'); assert yblob.get() == b'012'"] +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone --recursive https://github.com/jupyterlab/jupyter-collaboration.git + +WORKDIR "jupyter-collaboration" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_collaboration_tests.sh . + +RUN chmod +x run_jupyter_collaboration_tests.sh + +CMD ["./run_jupyter_collaboration_tests.sh"] diff --git a/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile b/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile new file mode 100644 index 00000000..0487bfa2 --- /dev/null +++ b/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyter-server/jupyter-scheduler + +WORKDIR "jupyter-scheduler" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_scheduler_tests.sh . + +RUN chmod +x run_jupyter_scheduler_tests.sh + +CMD ["./run_jupyter_scheduler_tests.sh"] + diff --git a/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile b/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile new file mode 100644 index 00000000..f7e44e17 --- /dev/null +++ b/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile @@ -0,0 +1,16 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyterhub/jupyter-server-proxy.git + +WORKDIR "jupyter-server-proxy" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_server_proxy_tests.sh . + +RUN chmod +x run_jupyter_server_proxy_tests.sh + +CMD ["./run_jupyter_server_proxy_tests.sh"] diff --git a/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile b/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile index 7d5cbd96..3b9faf86 100644 --- a/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile +++ b/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile @@ -3,4 +3,16 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyterlab_git"] +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone --recursive https://github.com/jupyterlab/jupyterlab-git + +WORKDIR "jupyterlab-git" + +RUN micromamba install --freeze-installed -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyterlab_git_tests.sh . +RUN chmod +x run_jupyterlab_git_tests.sh + +CMD ["./run_jupyterlab_git_tests.sh"] diff --git a/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile b/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile index c13df62a..21d66a8b 100644 --- a/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile +++ b/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile @@ -3,5 +3,8 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyter_lsp"] -CMD ["python", "-c", "import jupyterlab_lsp"] +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyterlab_lsp_tests.sh ./ +RUN chmod +x run_jupyterlab_lsp_tests.sh + +CMD ["./run_jupyterlab_lsp_tests.sh"] + diff --git a/test/test_artifacts/v2/langchain-aws.test.Dockerfile b/test/test_artifacts/v2/langchain-aws.test.Dockerfile deleted file mode 100644 index 73353bb0..00000000 --- a/test/test_artifacts/v2/langchain-aws.test.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG SAGEMAKER_DISTRIBUTION_IMAGE -FROM $SAGEMAKER_DISTRIBUTION_IMAGE - -ARG MAMBA_DOCKERFILE_ACTIVATE=1 - -CMD ["python", "-c", "import langchain_aws"] -CMD ["python", "-c", "from langchain_aws import BedrockLLM"] -CMD ["python", "-c", "from langchain_aws import ChatBedrock"] -CMD ["python", "-c", "from langchain_aws import SagemakerEndpoint"] -CMD ["python", "-c", "from langchain_aws import AmazonKendraRetriever"] -CMD ["python", "-c", "from langchain_aws import AmazonKnowledgeBasesRetriever"] -CMD ["python", "-c", "from langchain_aws import NeptuneAnalyticsGraph"] -CMD ["python", "-c", "from langchain_aws import NeptuneGraph"] diff --git a/test/test_artifacts/v2/langchain.test.Dockerfile b/test/test_artifacts/v2/langchain.test.Dockerfile new file mode 100644 index 00000000..80309ab1 --- /dev/null +++ b/test/test_artifacts/v2/langchain.test.Dockerfile @@ -0,0 +1,28 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y -c conda-forge pytest + +# Create the test script +RUN echo '#!/bin/bash' > /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'set -e' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'echo "Langchain version: $(python -c "import langchain; print(langchain.__version__)")"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'langchain_path=$(python -c "import langchain; import os; print(os.path.dirname(langchain.__file__))")' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'test_path="${langchain_path}/tests/unit_tests"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'if [ -d "$test_path" ]; then' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' pytest "$test_path" -v' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'else' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' echo "Unit tests directory not found at $test_path"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' echo "Available files in langchain directory:"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' find "$langchain_path" -name "*.py"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'fi' >> /home/sagemaker-user/run_langchain_tests.sh + +RUN chmod +x /home/sagemaker-user/run_langchain_tests.sh + +WORKDIR /home/sagemaker-user + +CMD ["./run_langchain_tests.sh"] \ No newline at end of file diff --git a/test/test_artifacts/v2/notebook.test.Dockerfile b/test/test_artifacts/v2/notebook.test.Dockerfile index 9afb9e08..f0bb8576 100644 --- a/test/test_artifacts/v2/notebook.test.Dockerfile +++ b/test/test_artifacts/v2/notebook.test.Dockerfile @@ -3,4 +3,15 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import notebook"] +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyter/notebook + +WORKDIR "notebook" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_notebook_tests.sh . + +RUN chmod +x run_notebook_tests.sh + +CMD ["./run_notebook_tests.sh"] + diff --git a/test/test_artifacts/v2/pyhive.test.Dockerfile b/test/test_artifacts/v2/pyhive.test.Dockerfile new file mode 100644 index 00000000..8259c098 --- /dev/null +++ b/test/test_artifacts/v2/pyhive.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/dropbox/PyHive.git + +WORKDIR "PyHive" + +RUN micromamba install --freeze-installed -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_pyhive_tests.sh . +RUN chmod +x run_pyhive_tests.sh + +CMD ["./run_pyhive_tests.sh"] diff --git a/test/test_artifacts/v2/python-lsp-server.test.Dockerfile b/test/test_artifacts/v2/python-lsp-server.test.Dockerfile index eb73f0e0..3d1946d5 100644 --- a/test/test_artifacts/v2/python-lsp-server.test.Dockerfile +++ b/test/test_artifacts/v2/python-lsp-server.test.Dockerfile @@ -3,5 +3,12 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -# "Confirm that installation succeeded" by running this - https://github.com/python-lsp/python-lsp-server#installation -CMD ["pylsp", "--help"] +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/python-lsp/python-lsp-server + +WORKDIR "python-lsp" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_python_lsp_server_tests.sh . + +RUN chmod +x run_python_lsp_server_tests.sh diff --git a/test/test_artifacts/v2/run_pandas_tests.py b/test/test_artifacts/v2/run_pandas_tests.py index a286443f..ee6dc383 100644 --- a/test/test_artifacts/v2/run_pandas_tests.py +++ b/test/test_artifacts/v2/run_pandas_tests.py @@ -24,7 +24,9 @@ "-m", "(not slow and not network and not db and not clipboard)", "-k", - "(not test_network and not s3 and not test_plain_axes)", + "(not test_network and not s3 and not test_plain_axes and not test_xsqlite_execute_closed_connection and not test_sql)", + "-W", + "ignore::PendingDeprecationWarning", "--no-strict-data-files", "--ignore", "pandas/tests/frame/test_arithmetic.py::TestFrameFlexArithmetic::test_floordiv_axis0_numexpr_path", diff --git a/test/test_artifacts/v2/s3fs.test.Dockerfile b/test/test_artifacts/v2/s3fs.test.Dockerfile index 8f3a0c68..5e182ad1 100644 --- a/test/test_artifacts/v2/s3fs.test.Dockerfile +++ b/test/test_artifacts/v2/s3fs.test.Dockerfile @@ -5,6 +5,7 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1 RUN git clone --recursive https://github.com/fsspec/s3fs.git WORKDIR "s3fs" + COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_s3fs_tests.sh . RUN chmod +x run_s3fs_tests.sh CMD ["./run_s3fs_tests.sh"] diff --git a/test/test_artifacts/v2/scikit-learn.test.Dockerfile b/test/test_artifacts/v2/scikit-learn.test.Dockerfile new file mode 100644 index 00000000..bb4e6a28 --- /dev/null +++ b/test/test_artifacts/v2/scikit-learn.test.Dockerfile @@ -0,0 +1,23 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y --name base -c conda-forge pytest pytest-cov + +RUN echo '#!/bin/bash' > /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'import_path=$(python -c "import sklearn; print(sklearn.__file__)")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'sklearn_path=$(dirname "$import_path")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'test_files=("test_base.py" "test_init.py")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'for test_file in "${test_files[@]}"; do' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo ' echo "Running tests in $test_file"' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo ' pytest -v "$sklearn_path/tests/$test_file"' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'done' >> /home/sagemaker-user/run_scikit_learn_tests.sh + +RUN chmod +x /home/sagemaker-user/run_scikit_learn_tests.sh + +WORKDIR /home/sagemaker-user + +CMD ["./run_scikit_learn_tests.sh"] \ No newline at end of file diff --git a/test/test_artifacts/v2/scripts/run_fastapi_tests.sh b/test/test_artifacts/v2/scripts/run_fastapi_tests.sh new file mode 100644 index 00000000..960ebf8f --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_fastapi_tests.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +fastapi_version=$(micromamba list | grep fastapi | tr -s ' ' | cut -d ' ' -f 3) + +git checkout tags/v$fastapi_version + +pip install -r requirements-tests.txt + +pytest tests/ -v -k "not test_tutorial" diff --git a/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh b/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh new file mode 100644 index 00000000..ba7afda2 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +jupyter nbconvert --execute --to python tests/test_borders.ipynb +jupyter nbconvert --execute --to python tests/test_sanitizer.ipynb diff --git a/test/test_artifacts/v2/scripts/run_jinja2_tests.sh b/test/test_artifacts/v2/scripts/run_jinja2_tests.sh new file mode 100644 index 00000000..e0cefa8a --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jinja2_tests.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -e + +# Test 1: Basic template +python -c " +from jinja2 import Template +template = Template('Hello {{ name }}!') +result = template.render(name='John') +assert result == 'Hello John!', f'Expected \"Hello John!\", got \"{result}\"' +" + +# Test 2: Conditional statements +python -c " +from jinja2 import Template +template = Template('{% if user %}Hello, {{ user }}!{% else %}Hello, stranger!{% endif %}') +result1 = template.render(user='Alice') +result2 = template.render(user=None) +assert result1 == 'Hello, Alice!', f'Expected \"Hello, Alice!\", got \"{result1}\"' +assert result2 == 'Hello, stranger!', f'Expected \"Hello, stranger!\", got \"{result2}\"' +" + +# Test 3: Loops +python -c " +from jinja2 import Template +template = Template('{% for item in items %}{{ item }} {% endfor %}') +result = template.render(items=['apple', 'banana', 'cherry']) +assert result == 'apple banana cherry ', f'Expected \"apple banana cherry \", got \"{result}\"' +" + +# Test 4: Filters +python -c " +from jinja2 import Template +template = Template('{{ name|upper }}') +result = template.render(name='john') +assert result == 'JOHN', f'Expected \"JOHN\", got \"{result}\"' +" + +# Test 5: File system loader +echo "