@@ -11820,7 +11820,7 @@ <h1 id="Efficient-use-of-pytest-fixtures">Efficient use of <code>pytest</code> f
1182011820< div class =" highlight hl-ipython3 "> < pre > < span > </ span > < span class ="c1 "> # Let's make sure pytest and ipytest packages are installed</ span >
1182111821< span class ="c1 "> # ipytest is required for running pytest inside Jupyter notebooks</ span >
1182211822< span class ="kn "> import</ span > < span class ="nn "> sys</ span >
11823- < span class ="o "> !{</ span > sys.executable< span class ="o "> }</ span > -m pip install pytest ipytest
11823+ < span class ="o "> !{</ span > sys.executable< span class ="o "> }</ span > -m pip install pytest ipytest> < span class =" o " > = </ span > < span class =" m " > 0 </ span > .3.0
1182411824
1182511825< span class ="kn "> import</ span > < span class ="nn "> pytest</ span >
1182611826< span class ="kn "> from</ span > < span class ="nn "> ipytest</ span > < span class ="k "> import</ span > < span class ="n "> magics</ span > < span class ="p "> ,</ span > < span class ="n "> clean_tests</ span >
@@ -11831,31 +11831,6 @@ <h1 id="Efficient-use-of-pytest-fixtures">Efficient use of <code>pytest</code> f
1183111831</ div >
1183211832</ div >
1183311833
11834- < div class ="output_wrapper ">
11835- < div class ="output ">
11836-
11837-
11838- < div class ="output_area ">
11839-
11840- < div class ="prompt "> </ div >
11841-
11842-
11843- < div class ="output_subarea output_stream output_stdout output_text ">
11844- < pre > Requirement already satisfied: pytest in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (3.5.0)
11845- Requirement already satisfied: ipytest in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (0.2.2)
11846- Requirement already satisfied: pluggy<0.7,>=0.5 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (0.6.0)
11847- Requirement already satisfied: six>=1.10.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (1.11.0)
11848- Requirement already satisfied: more-itertools>=4.0.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (4.1.0)
11849- Requirement already satisfied: attrs>=17.4.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (17.4.0)
11850- Requirement already satisfied: py>=1.5.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (1.5.3)
11851- Requirement already satisfied: setuptools in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (39.0.1)
11852- </ pre >
11853- </ div >
11854- </ div >
11855-
11856- </ div >
11857- </ div >
11858-
1185911834</ div >
1186011835< div class ="cell border-box-sizing text_cell rendered "> < div class ="prompt input_prompt ">
1186111836</ div >
@@ -11908,7 +11883,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
1190811883
1190911884
1191011885< div class ="output_subarea output_stream output_stdout output_text ">
11911- < pre > =========================================================== test session starts ===========================================================
11886+ < pre > =================================================================================== test session starts ========================= ===========================================================
1191211887platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1191311888rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1191411889plugins: nbval-0.9.0
@@ -11918,7 +11893,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
1191811893./bar/baz.txt
1191911894.
1192011895
11921- ======================================================== 2 passed in 0.02 seconds =========================================================
11896+ ================================================================================= 2 passed in 0.02 seconds ======================== =========================================================
1192211897</ pre >
1192311898</ div >
1192411899</ div >
@@ -11986,7 +11961,7 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
1198611961
1198711962
1198811963< div class ="output_subarea output_stream output_stdout output_text ">
11989- < pre > =========================================================== test session starts ===========================================================
11964+ < pre > =================================================================================== test session starts ========================= ===========================================================
1199011965platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1199111966rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1199211967plugins: nbval-0.9.0
@@ -11999,12 +11974,12 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
1199911974here we use also other_fixture which returns: FOO
1200011975.
1200111976
12002- ============================================================ warnings summary =============================================================
11977+ ===================================================================================== warnings summary ======================== =============================================================
1200311978None
1200411979 Module already imported so cannot be rewritten: nbval
1200511980
1200611981-- Docs: http://doc.pytest.org/en/latest/warnings.html
12007- ================================================== 2 passed, 1 warnings in 0.02 seconds ===================================================
11982+ =========================================================================== 2 passed, 1 warnings in 0.03 seconds ======================== ===================================================
1200811983</ pre >
1200911984</ div >
1201011985</ div >
@@ -12093,20 +12068,20 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1209312068
1209412069
1209512070< div class ="output_subarea output_stream output_stdout output_text ">
12096- < pre > =========================================================== test session starts ===========================================================
12071+ < pre > =================================================================================== test session starts ========================= ===========================================================
1209712072platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1209812073rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1209912074plugins: nbval-0.9.0
1210012075collected 2 items
1210112076
1210212077pytest_fixtures.py ..
1210312078
12104- ============================================================ warnings summary =============================================================
12079+ ===================================================================================== warnings summary ======================== =============================================================
1210512080None
1210612081 Module already imported so cannot be rewritten: nbval
1210712082
1210812083-- Docs: http://doc.pytest.org/en/latest/warnings.html
12109- ================================================== 2 passed, 1 warnings in 0.02 seconds ===================================================
12084+ =========================================================================== 2 passed, 1 warnings in 0.03 seconds ======================== ===================================================
1211012085</ pre >
1211112086</ div >
1211212087</ div >
@@ -12187,7 +12162,7 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1218712162
1218812163
1218912164< div class ="output_subarea output_stream output_stdout output_text ">
12190- < pre > =========================================================== test session starts ===========================================================
12165+ < pre > =================================================================================== test session starts ========================= ===========================================================
1219112166platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1219212167rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1219312168plugins: nbval-0.9.0
@@ -12197,12 +12172,12 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1219712172This is modified truth
1219812173.
1219912174
12200- ============================================================ warnings summary =============================================================
12175+ ===================================================================================== warnings summary ======================== =============================================================
1220112176None
1220212177 Module already imported so cannot be rewritten: nbval
1220312178
1220412179-- Docs: http://doc.pytest.org/en/latest/warnings.html
12205- ================================================== 1 passed, 1 warnings in 0.02 seconds ===================================================
12180+ =========================================================================== 1 passed, 1 warnings in 0.02 seconds ======================== ===================================================
1220612181</ pre >
1220712182</ div >
1220812183</ div >
@@ -12264,20 +12239,20 @@ <h3 id="tmpdir"><a href="https://docs.pytest.org/en/latest/tmpdir.html#the-tmpdi
1226412239
1226512240
1226612241< div class ="output_subarea output_stream output_stdout output_text ">
12267- < pre > =========================================================== test session starts ===========================================================
12242+ < pre > =================================================================================== test session starts ========================= ===========================================================
1226812243platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1226912244rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1227012245plugins: nbval-0.9.0
1227112246collected 1 item
1227212247
1227312248pytest_fixtures.py .
1227412249
12275- ============================================================ warnings summary =============================================================
12250+ ===================================================================================== warnings summary ======================== =============================================================
1227612251None
1227712252 Module already imported so cannot be rewritten: nbval
1227812253
1227912254-- Docs: http://doc.pytest.org/en/latest/warnings.html
12280- ================================================== 1 passed, 1 warnings in 0.03 seconds ===================================================
12255+ =========================================================================== 1 passed, 1 warnings in 0.03 seconds ======================== ===================================================
1228112256</ pre >
1228212257</ div >
1228312258</ div >
@@ -12346,7 +12321,7 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
1234612321
1234712322
1234812323< div class ="output_subarea output_stream output_stdout output_text ">
12349- < pre > =========================================================== test session starts ===========================================================
12324+ < pre > =================================================================================== test session starts ========================= ===========================================================
1235012325platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1235112326rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1235212327plugins: nbval-0.9.0
@@ -12362,12 +12337,12 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
1236212337func
1236312338.
1236412339
12365- ============================================================ warnings summary =============================================================
12340+ ===================================================================================== warnings summary ======================== =============================================================
1236612341None
1236712342 Module already imported so cannot be rewritten: nbval
1236812343
1236912344-- Docs: http://doc.pytest.org/en/latest/warnings.html
12370- ================================================== 2 passed, 1 warnings in 0.02 seconds ===================================================
12345+ =========================================================================== 2 passed, 1 warnings in 0.02 seconds ======================== ===================================================
1237112346</ pre >
1237212347</ div >
1237312348</ div >
@@ -12428,7 +12403,7 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
1242812403
1242912404
1243012405< div class ="output_subarea output_stream output_stdout output_text ">
12431- < pre > =========================================================== test session starts ===========================================================
12406+ < pre > =================================================================================== test session starts ========================= ===========================================================
1243212407platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1243312408rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1243412409plugins: nbval-0.9.0
@@ -12441,12 +12416,12 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
1244112416this will be run after test execution, you can do e.g. some clean up here
1244212417
1244312418
12444- ============================================================ warnings summary =============================================================
12419+ ===================================================================================== warnings summary ======================== =============================================================
1244512420None
1244612421 Module already imported so cannot be rewritten: nbval
1244712422
1244812423-- Docs: http://doc.pytest.org/en/latest/warnings.html
12449- ================================================== 1 passed, 1 warnings in 0.02 seconds ===================================================
12424+ =========================================================================== 1 passed, 1 warnings in 0.02 seconds ======================== ===================================================
1245012425</ pre >
1245112426</ div >
1245212427</ div >
@@ -12506,7 +12481,7 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
1250612481
1250712482
1250812483< div class ="output_subarea output_stream output_stdout output_text ">
12509- < pre > =========================================================== test session starts ===========================================================
12484+ < pre > =================================================================================== test session starts ========================= ===========================================================
1251012485platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1251112486rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1251212487plugins: nbval-0.9.0
@@ -12518,12 +12493,12 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
1251812493using my_fixture
1251912494.
1252012495
12521- ============================================================ warnings summary =============================================================
12496+ ===================================================================================== warnings summary ======================== =============================================================
1252212497None
1252312498 Module already imported so cannot be rewritten: nbval
1252412499
1252512500-- Docs: http://doc.pytest.org/en/latest/warnings.html
12526- ================================================== 2 passed, 1 warnings in 0.03 seconds ===================================================
12501+ =========================================================================== 2 passed, 1 warnings in 0.02 seconds ======================== ===================================================
1252712502</ pre >
1252812503</ div >
1252912504</ div >
0 commit comments