From e2b61455f75708063a4a30ebbf72bb3c222cf1ae Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Tue, 3 Dec 2019 15:20:17 +0100
Subject: [PATCH] tests: suppress warnings from jupyter notebook runner

---
 conftest.py | 8 ++++++--
 pytest.ini  | 3 +++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/conftest.py b/conftest.py
index 4da087be5..d1da0451a 100644
--- a/conftest.py
+++ b/conftest.py
@@ -3,6 +3,7 @@ import pytest
 import tempfile
 import runpy
 import sys
+import warnings
 # Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
 # at the same time
 from pystencils.cpu import cpujit
@@ -128,8 +129,11 @@ class IPyNbFile(pytest.File):
         exporter.exclude_input_prompt = True
 
         notebook_contents = self.fspath.open()
-        notebook = nbformat.read(notebook_contents, 4)
-        code, _ = exporter.from_notebook_node(notebook)
+
+        with warnings.catch_warnings():
+            warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated")
+            notebook = nbformat.read(notebook_contents, 4)
+            code, _ = exporter.from_notebook_node(notebook)
         yield IPyNbTest(self.name, self, code)
 
     def teardown(self):
diff --git a/pytest.ini b/pytest.ini
index 88de625d4..4e9f5cadd 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -2,6 +2,9 @@
 python_files = test_*.py *_test.py scenario_*.py
 norecursedirs = *.egg-info .git .cache .ipynb_checkpoints htmlcov
 addopts = --doctest-modules --durations=20  --cov-config pytest.ini
+markers =
+       gpu: test that require a gpu
+       kerncraft: tests depending on kerncraft
 
 [run]
 branch = True
-- 
GitLab