@@ -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> < span class ="o " > = </ span > < span class =" m " > 0 </ span > .3.0
11823+ < span class ="o "> !{</ span > sys.executable< span class ="o "> }</ span > -m pip install pytest < span class ="s1 " > 'ipytest>=0 .3.0' </ span >
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,6 +11831,31 @@ <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>=0.3.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (0.3.0)
11846+ Requirement already satisfied: attrs>=17.4.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (17.4.0)
11847+ Requirement already satisfied: pluggy<0.7,>=0.5 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (0.6.0)
11848+ Requirement already satisfied: setuptools in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (39.0.1)
11849+ Requirement already satisfied: py>=1.5.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (1.5.3)
11850+ Requirement already satisfied: more-itertools>=4.0.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (4.1.0)
11851+ Requirement already satisfied: six>=1.10.0 in /Users/jerry/.virtualenvs/learn-python3/lib/python3.5/site-packages (from pytest) (1.11.0)
11852+ </ pre >
11853+ </ div >
11854+ </ div >
11855+
11856+ </ div >
11857+ </ div >
11858+
1183411859</ div >
1183511860< div class ="cell border-box-sizing text_cell rendered "> < div class ="prompt input_prompt ">
1183611861</ div >
@@ -11883,7 +11908,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
1188311908
1188411909
1188511910< div class ="output_subarea output_stream output_stdout output_text ">
11886- < pre > =================================================================================== test session starts === =================================================================================
11911+ < pre > ================================================================================ test session starts =================================================================================
1188711912platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1188811913rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1188911914plugins: nbval-0.9.0
@@ -11893,7 +11918,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
1189311918./bar/baz.txt
1189411919.
1189511920
11896- ================================================================================= 2 passed in 0.02 seconds === ==============================================================================
11921+ ============================================================================== 2 passed in 0.02 seconds ==============================================================================
1189711922</ pre >
1189811923</ div >
1189911924</ div >
@@ -11961,7 +11986,7 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
1196111986
1196211987
1196311988< div class ="output_subarea output_stream output_stdout output_text ">
11964- < pre > =================================================================================== test session starts === =================================================================================
11989+ < pre > ================================================================================ test session starts =================================================================================
1196511990platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1196611991rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1196711992plugins: nbval-0.9.0
@@ -11974,12 +11999,12 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
1197411999here we use also other_fixture which returns: FOO
1197512000.
1197612001
11977- ===================================================================================== warnings summary === ==================================================================================
12002+ ================================================================================== warnings summary ==================================================================================
1197812003None
1197912004 Module already imported so cannot be rewritten: nbval
1198012005
1198112006-- Docs: http://doc.pytest.org/en/latest/warnings.html
11982- =========================================================================== 2 passed, 1 warnings in 0.03 seconds === ========================================================================
12007+ ======================================================================== 2 passed, 1 warnings in 0.02 seconds ========================================================================
1198312008</ pre >
1198412009</ div >
1198512010</ div >
@@ -12068,20 +12093,20 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1206812093
1206912094
1207012095< div class ="output_subarea output_stream output_stdout output_text ">
12071- < pre > =================================================================================== test session starts === =================================================================================
12096+ < pre > ================================================================================ test session starts =================================================================================
1207212097platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1207312098rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1207412099plugins: nbval-0.9.0
1207512100collected 2 items
1207612101
1207712102pytest_fixtures.py ..
1207812103
12079- ===================================================================================== warnings summary === ==================================================================================
12104+ ================================================================================== warnings summary ==================================================================================
1208012105None
1208112106 Module already imported so cannot be rewritten: nbval
1208212107
1208312108-- Docs: http://doc.pytest.org/en/latest/warnings.html
12084- =========================================================================== 2 passed, 1 warnings in 0.03 seconds === ========================================================================
12109+ ======================================================================== 2 passed, 1 warnings in 0.02 seconds ========================================================================
1208512110</ pre >
1208612111</ div >
1208712112</ div >
@@ -12162,7 +12187,7 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1216212187
1216312188
1216412189< div class ="output_subarea output_stream output_stdout output_text ">
12165- < pre > =================================================================================== test session starts === =================================================================================
12190+ < pre > ================================================================================ test session starts =================================================================================
1216612191platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1216712192rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1216812193plugins: nbval-0.9.0
@@ -12172,12 +12197,12 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
1217212197This is modified truth
1217312198.
1217412199
12175- ===================================================================================== warnings summary === ==================================================================================
12200+ ================================================================================== warnings summary ==================================================================================
1217612201None
1217712202 Module already imported so cannot be rewritten: nbval
1217812203
1217912204-- Docs: http://doc.pytest.org/en/latest/warnings.html
12180- =========================================================================== 1 passed, 1 warnings in 0.02 seconds === ========================================================================
12205+ ======================================================================== 1 passed, 1 warnings in 0.02 seconds ========================================================================
1218112206</ pre >
1218212207</ div >
1218312208</ div >
@@ -12239,20 +12264,20 @@ <h3 id="tmpdir"><a href="https://docs.pytest.org/en/latest/tmpdir.html#the-tmpdi
1223912264
1224012265
1224112266< div class ="output_subarea output_stream output_stdout output_text ">
12242- < pre > =================================================================================== test session starts === =================================================================================
12267+ < pre > ================================================================================ test session starts =================================================================================
1224312268platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1224412269rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1224512270plugins: nbval-0.9.0
1224612271collected 1 item
1224712272
1224812273pytest_fixtures.py .
1224912274
12250- ===================================================================================== warnings summary === ==================================================================================
12275+ ================================================================================== warnings summary ==================================================================================
1225112276None
1225212277 Module already imported so cannot be rewritten: nbval
1225312278
1225412279-- Docs: http://doc.pytest.org/en/latest/warnings.html
12255- =========================================================================== 1 passed, 1 warnings in 0.03 seconds === ========================================================================
12280+ ======================================================================== 1 passed, 1 warnings in 0.02 seconds ========================================================================
1225612281</ pre >
1225712282</ div >
1225812283</ div >
@@ -12321,7 +12346,7 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
1232112346
1232212347
1232312348< div class ="output_subarea output_stream output_stdout output_text ">
12324- < pre > =================================================================================== test session starts === =================================================================================
12349+ < pre > ================================================================================ test session starts =================================================================================
1232512350platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1232612351rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1232712352plugins: nbval-0.9.0
@@ -12337,12 +12362,12 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
1233712362func
1233812363.
1233912364
12340- ===================================================================================== warnings summary === ==================================================================================
12365+ ================================================================================== warnings summary ==================================================================================
1234112366None
1234212367 Module already imported so cannot be rewritten: nbval
1234312368
1234412369-- Docs: http://doc.pytest.org/en/latest/warnings.html
12345- =========================================================================== 2 passed, 1 warnings in 0.02 seconds === ========================================================================
12370+ ======================================================================== 2 passed, 1 warnings in 0.02 seconds ========================================================================
1234612371</ pre >
1234712372</ div >
1234812373</ div >
@@ -12403,7 +12428,7 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
1240312428
1240412429
1240512430< div class ="output_subarea output_stream output_stdout output_text ">
12406- < pre > =================================================================================== test session starts === =================================================================================
12431+ < pre > ================================================================================ test session starts =================================================================================
1240712432platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1240812433rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1240912434plugins: nbval-0.9.0
@@ -12416,12 +12441,12 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
1241612441this will be run after test execution, you can do e.g. some clean up here
1241712442
1241812443
12419- ===================================================================================== warnings summary === ==================================================================================
12444+ ================================================================================== warnings summary ==================================================================================
1242012445None
1242112446 Module already imported so cannot be rewritten: nbval
1242212447
1242312448-- Docs: http://doc.pytest.org/en/latest/warnings.html
12424- =========================================================================== 1 passed, 1 warnings in 0.02 seconds === ========================================================================
12449+ ======================================================================== 1 passed, 1 warnings in 0.02 seconds ========================================================================
1242512450</ pre >
1242612451</ div >
1242712452</ div >
@@ -12481,7 +12506,7 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
1248112506
1248212507
1248312508< div class ="output_subarea output_stream output_stdout output_text ">
12484- < pre > =================================================================================== test session starts === =================================================================================
12509+ < pre > ================================================================================ test session starts =================================================================================
1248512510platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
1248612511rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
1248712512plugins: nbval-0.9.0
@@ -12493,12 +12518,12 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
1249312518using my_fixture
1249412519.
1249512520
12496- ===================================================================================== warnings summary === ==================================================================================
12521+ ================================================================================== warnings summary ==================================================================================
1249712522None
1249812523 Module already imported so cannot be rewritten: nbval
1249912524
1250012525-- Docs: http://doc.pytest.org/en/latest/warnings.html
12501- =========================================================================== 2 passed, 1 warnings in 0.02 seconds === ========================================================================
12526+ ======================================================================== 2 passed, 1 warnings in 0.02 seconds ========================================================================
1250212527</ pre >
1250312528</ div >
1250412529</ div >
0 commit comments