You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h3id="Running-pytest-inside-notebooks">Running pytest inside notebooks<aclass="anchor-link" href="#Running-pytest-inside-notebooks">¶</a></h3><p>These are the steps required to run pytest inside Jupyter cells.</p>
11844
+
<h3id="Running-pytest-inside-notebooks">Running pytest inside notebooks<aclass="anchor-link" href="#Running-pytest-inside-notebooks">¶</a></h3><p>These are the steps required to run pytest inside Jupyter cells. You can copy the content of this cell to the top of your notebook which contains tests.</p>
11845
11845
11846
11846
</div>
11847
11847
</div>
@@ -11851,10 +11851,17 @@ <h3 id="Running-pytest-inside-notebooks">Running pytest inside notebooks<a class
<h2id="pytest-test-cases"><code>pytest</code> test cases<aclass="anchor-link" href="#pytest-test-cases">¶</a></h2><p>Let's consider we have a function called <code>sum_of_three_numbers</code> for which we want to write a test.</p>
<p>Due to technical limitations of Jupyter notebooks and pytest extension, all code that runs inside tests has to be in the same cell. In other words, you can not call e.g. functions that are defined in other cells.</p>
11910
-
<p>In real applications you have separate directory and .py files for your tests. The above mentioned limititation is only present for writing tests in Jupyter environment.</p>
<h2id="pytest-test-cases"><code>pytest</code> test cases<aclass="anchor-link" href="#pytest-test-cases">¶</a></h2><p>Pytest test cases are actually quite similar as you have already seen in the exercises. Most of the exercises are structured like pytest test cases by dividing each exercise into three cells:</p>
11925
+
<p>Pytest test cases are actually quite similar as you have already seen in the exercises. Most of the exercises are structured like pytest test cases by dividing each exercise into three cells:</p>
11920
11926
<ol>
11921
11927
<li>Setup the variables used in the test</li>
11922
11928
<li>Your implementation</li>
@@ -11932,12 +11938,9 @@ <h2 id="pytest-test-cases"><code>pytest</code> test cases<a class="anchor-link"
<pre>============================================================ test session starts ============================================================
11974
+
<pre>================================================================================================= test session starts =================================================================================================
11972
11975
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
0 commit comments