From 73608c919a878fec05318d4c7880adb184353a9f Mon Sep 17 00:00:00 2001 From: Thor Kell Date: Tue, 25 Sep 2018 15:05:51 +0200 Subject: [PATCH] New python test script, rm old shell script --- scripts/test_tutorial_install.py | 34 ++++++++++++++++ scripts/test_tutorial_install.sh | 69 -------------------------------- 2 files changed, 34 insertions(+), 69 deletions(-) create mode 100644 scripts/test_tutorial_install.py delete mode 100755 scripts/test_tutorial_install.sh diff --git a/scripts/test_tutorial_install.py b/scripts/test_tutorial_install.py new file mode 100644 index 0000000..e91be5e --- /dev/null +++ b/scripts/test_tutorial_install.py @@ -0,0 +1,34 @@ +import os + +commands = [ + 'git --version', + 'python --version', + 'python -c "import flake8"', + 'python -c "import jupyter"', + 'python -c "import jupyter"', + 'python -c "import matplotlib"', + 'python -c "import numpy"', + 'python -c "import scipy"', + 'python -c "import pytest"', + 'python -c "import sphinx"', + ] + +# Check everything except conda +success_flag = True +for command in commands: + if os.system(command) != 0: + success_flag = False + print("Failure! %s failed" % command) + +# Check conda because its magic setup does not let us just run it. +if not os.environ['CONDA_EXE'] or not os.environ['CONDA_PYTHON_EXE']: + print('Install check failed! Conda is not installed correctly!') + success_flag = False +else: + print('Conda installed and set in environment.') + +# Final results +if success_flag is False: + print('Install check failed! Please see the above error messages. 🔥🔥🔥') +else: + print('Success! Everything has installed correctly. 😊😊😊') diff --git a/scripts/test_tutorial_install.sh b/scripts/test_tutorial_install.sh deleted file mode 100755 index d4d8aaf..0000000 --- a/scripts/test_tutorial_install.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -# Add conda magic to this environment -. ~/anaconda3/etc/profile.d/conda.sh - -echo "Checking git and conda" -git --version -if [ $? -ne 0 ] -then - echo "Error! Git is not installed!" -fi - -conda --version -if [ $? -ne 0 ] -then - echo "Error! Anaconda is not installed!" -fi - -echo "Checking Python version" -python --version -if [ $? -ne 0 ] -then - echo "Error! Python is not installed, which probably means that Anaconda did not install correctly!" -fi - -echo "Checking Python packages ..." -python -c "import flake8" -if [ $? -ne 0 ] -then - echo "Error! You're missing flake8, a Python package." -fi - -python -c "import jupyter" -if [ $? -ne 0 ] -then - echo "Error! You're missing jupyter, a Python package." -fi - -python -c "import matplotlib" -if [ $? -ne 0 ] -then - echo "Error! You're missing matplotlib, a Python package." -fi - -python -c "import numpy" -if [ $? -ne 0 ] -then - echo "Error! You're missing numpy, a Python package." -fi - -python -c "import scipy" -if [ $? -ne 0 ] -then - echo "Error! You're missing scipy, a Python package." -fi - -python -c "import pytest" -if [ $? -ne 0 ] -then - echo "Error! You're missing pytest, a Python package." -fi - -python -c "import sphinx" -if [ $? -ne 0 ] -then - echo "Error! You're missing sphinx, a Python package." -fi - -echo "Success! Everything appears to be installed!"