From 086603bd365837749664f4e3a85cc6d915547843 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Sat, 17 Aug 2019 22:57:39 +0200
Subject: [PATCH] Add Travis build with pystencils from pip

---
 .travis.yml                                     |  7 +++++++
 tests/backends/test_torch_native_compilation.py |  9 ---------
 tests/test_autodiff.py                          |  8 --------
 tests/test_tfmad.py                             | 11 -----------
 tests/travis_install.sh                         |  8 ++++++--
 5 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8bed00e..9b355a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -14,11 +14,18 @@ addons:
     update: true
 matrix:
   fast_finish: true
+  allow_failures:
+    - name: "Pystencils from pip"
   include:
     - python: 3.6
       env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py36" COVERAGE="true" LINT="false"
       before_install:
         - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit
+    - python: 3.6
+      name: "Pystencils from pip"
+      env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py36" COVERAGE="true" LINT="false" PYSTENCIL_FROM_PIP="true"
+      before_install:
+        - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit
     - name: "Conda"
       env: DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="false" LINT="false"
       before_install:
diff --git a/tests/backends/test_torch_native_compilation.py b/tests/backends/test_torch_native_compilation.py
index b291f67..f552192 100644
--- a/tests/backends/test_torch_native_compilation.py
+++ b/tests/backends/test_torch_native_compilation.py
@@ -194,12 +194,3 @@ def test_execute_torch_gpu():
     print(y_tensor)
     print(rtn)
 
-
-def main():
-    test_jit()
-    test_torch_native_compilation()
-    # test_generate_torch()
-    # test_execute_torch()
-
-
-main()
diff --git a/tests/test_autodiff.py b/tests/test_autodiff.py
index 8d3f535..4d917e9 100644
--- a/tests/test_autodiff.py
+++ b/tests/test_autodiff.py
@@ -50,11 +50,3 @@ def test_simple_2d_check_raw_assignments():
         pystencils_autodiff.create_backward_assignments(
             forward_assignments, diff_mode=diff_mode)
 
-
-def main():
-    test_simple_2d_check_assignment_collection()
-    test_simple_2d_check_raw_assignments()
-
-
-if __name__ == '__main__':
-    main()
diff --git a/tests/test_tfmad.py b/tests/test_tfmad.py
index 309ec94..8b18209 100644
--- a/tests/test_tfmad.py
+++ b/tests/test_tfmad.py
@@ -247,14 +247,3 @@ def test_tfmad_two_outputs():
     print(curl_op.backward_assignments)
 
 
-def main():
-    # test_tfmad_stencil()
-    # test_tfmad_two_stencils()
-    # test_tfmad_gradient_check_torch()
-    test_tfmad_gradient_check()
-    # test_tfmad_vector_input_data()
-    # test_tfmad_two_outputs()
-
-
-if __name__ == '__main__':
-    main()
diff --git a/tests/travis_install.sh b/tests/travis_install.sh
index 5eaf44f..8838864 100644
--- a/tests/travis_install.sh
+++ b/tests/travis_install.sh
@@ -45,8 +45,12 @@ pip install -U pip setuptools
 pip install tox
 pip install codecov
 pip install sphinx
-# use newest pystencils
-pip install git+https://github.com/mabau/pystencils.git
+
+if [[ -z "$PYSTENCIL_FROM_PIP" ]]; then
+    pip install git+https://github.com/mabau/pystencils.git
+else
+    pip install pystencils
+fi
 pip install flake8
 
 if [[ "$COVERAGE" == "true" ]]; then
-- 
GitLab