Skip to content

Commit

Permalink
Python package: updated our macOS binary (closes #2256).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Dec 13, 2019
2 parents afe3b53 + 8650758 commit 76a1ffc
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/plugins/support/PythonSupport/CMakeLists.txt
Expand Up @@ -18,6 +18,7 @@ ADD_PLUGIN(PythonSupport
basictests
coveragetests
hodgkinhuxley1952tests
importstests
noble1962tests
vanderpol1928tests
)
103 changes: 103 additions & 0 deletions src/plugins/support/PythonSupport/tests/data/importstests.py
@@ -0,0 +1,103 @@
if __name__ == '__main__':
# Make sure that we can import the modules that should be bundled with our
# Python package

try:
import bz2
except ImportError:
print("The 'bz2' module is not present!")

try:
import ipykernel
except ImportError:
print("The 'ipykernel' module is not present!")

try:
import IPython
except ImportError:
print("The 'IPython' module is not present!")

try:
import ipywidgets
except ImportError:
print("The 'ipywidgets' module is not present!")

try:
import jupyter_console
except ImportError:
print("The 'jupyter_console' module is not present!")

try:
import jupyterlab
except ImportError:
print("The 'jupyterlab' module is not present!")

try:
import lxml
except ImportError:
print("The 'lxml' module is not present!")

try:
import lzma
except ImportError:
print("The 'lzma' module is not present!")

try:
import matplotlib
except ImportError:
print("The 'matplotlib' module is not present!")

try:
import nbconvert
except ImportError:
print("The 'nbconvert' module is not present!")

try:
import notebook
except ImportError:
print("The 'notebook' module is not present!")

try:
import numpy
except ImportError:
print("The 'numpy' module is not present!")

try:
import qimage2ndarray
except ImportError:
print("The 'qimage2ndarray' module is not present!")

try:
import qtconsole
except ImportError:
print("The 'qtconsole' module is not present!")

try:
import scipy
except ImportError:
print("The 'scipy' module is not present!")

try:
import sphinx
except ImportError:
print("The 'sphinx' module is not present!")

try:
import sqlite3
except ImportError:
print("The 'sqlite3' module is not present!")

try:
import ssl
except ImportError:
print("The 'ssl' module is not present!")

try:
import traitlets
except ImportError:
print("The 'traitlets' module is not present!")

try:
import zlib
except ImportError:
print("The 'zlib' module is not present!")
@@ -0,0 +1,13 @@
The 'ipykernel' module is not present!
The 'IPython' module is not present!
The 'ipywidgets' module is not present!
The 'jupyter_console' module is not present!
The 'jupyterlab' module is not present!
The 'lxml' module is not present!
The 'matplotlib' module is not present!
The 'nbconvert' module is not present!
The 'notebook' module is not present!
The 'qimage2ndarray' module is not present!
The 'qtconsole' module is not present!
The 'scipy' module is not present!
The 'traitlets' module is not present!
56 changes: 56 additions & 0 deletions src/plugins/support/PythonSupport/tests/importstests.cpp
@@ -0,0 +1,56 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://gnu.org/licenses>.
*******************************************************************************/

//==============================================================================
// Python support imports tests
//==============================================================================

#include "../../../../tests/src/testsutils.h"

//==============================================================================

#include "importstests.h"

//==============================================================================

#include <QtTest/QtTest>

//==============================================================================

void ImportsTests::tests()
{
// Some basic tests to make sure that we can use our Python wrappers

QStringList output;

QVERIFY(!OpenCOR::runCli(QStringList() << "-c" << "PythonShell" << OpenCOR::fileName("src/plugins/support/PythonSupport/tests/data/importstests.py"), output));
#if defined(Q_OS_WIN) && defined(QT_DEBUG)
QCOMPARE(output, OpenCOR::fileContents(OpenCOR::fileName(QString("src/plugins/support/PythonSupport/tests/data/%1/importstests.out").arg(OpenCOR::targetPlatformDir()))));
#else
QCOMPARE(output, QStringList() << QString());
#endif
}

//==============================================================================

QTEST_GUILESS_MAIN(ImportsTests)

//==============================================================================
// End of file
//==============================================================================
42 changes: 42 additions & 0 deletions src/plugins/support/PythonSupport/tests/importstests.h
@@ -0,0 +1,42 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://gnu.org/licenses>.
*******************************************************************************/

//==============================================================================
// Python support imports tests
//==============================================================================

#pragma once

//==============================================================================

#include <QObject>

//==============================================================================

class ImportsTests : public QObject
{
Q_OBJECT

private slots:
void tests();
};

//==============================================================================
// End of file
//==============================================================================
6 changes: 3 additions & 3 deletions src/plugins/thirdParty/Python/CMakeLists.txt
Expand Up @@ -237,11 +237,11 @@ if(USE_PREBUILT_PYTHON_PACKAGE)
endif()
elseif(APPLE)
retrieve_package_file(${PACKAGE_NAME} ${PACKAGE_VERSION}
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} f9bfffda06db7002cb5a927373026293d4b6bdb5
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} bdd08ebae1b333334dfc216f2fa33e0e9f2cbd67
PACKAGE_REPOSITORY ${PACKAGE_REPOSITORY}
SHA1_FILES ${SHA1_FILES}
SHA1_VALUES 093ac9aec869547e7b2817467474c24c6920e174
12cb8a2c0bcf557aaf6e6bc359c9c252e6f32320)
SHA1_VALUES 527efe36f3f59beb888f988e6039234f50dc87a2
a5bb84978412350b916071805f2632fcce4dac25)
else()
retrieve_package_file(${PACKAGE_NAME} ${PACKAGE_VERSION}
${FULL_LOCAL_EXTERNAL_PACKAGE_DIR} d6d9ad358816df273bd0fce4e176aeb94fb76dcc
Expand Down

0 comments on commit 76a1ffc

Please sign in to comment.