@@ -11820,7 +11820,7 @@ <h1 id="Efficient-use-of-pytest-fixtures">Efficient use of <code>pytest</code> f
11820
11820
< div class =" highlight hl-ipython3 "> < pre > < span > </ span > < span class ="c1 "> # Let's make sure pytest and ipytest packages are installed</ span >
11821
11821
< span class ="c1 "> # ipytest is required for running pytest inside Jupyter notebooks</ span >
11822
11822
< 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 >
11824
11824
11825
11825
< span class ="kn "> import</ span > < span class ="nn "> pytest</ span >
11826
11826
< 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
11831
11831
</ div >
11832
11832
</ div >
11833
11833
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
+
11834
11859
</ div >
11835
11860
< div class ="cell border-box-sizing text_cell rendered "> < div class ="prompt input_prompt ">
11836
11861
</ div >
@@ -11883,7 +11908,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
11883
11908
11884
11909
11885
11910
< div class ="output_subarea output_stream output_stdout output_text ">
11886
- < pre > =================================================================================== test session starts === =================================================================================
11911
+ < pre > ================================================================================ test session starts =================================================================================
11887
11912
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
11888
11913
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
11889
11914
plugins: nbval-0.9.0
@@ -11893,7 +11918,7 @@ <h2 id="Parametrizing-fixtures">Parametrizing fixtures<a class="anchor-link" hre
11893
11918
./bar/baz.txt
11894
11919
.
11895
11920
11896
- ================================================================================= 2 passed in 0.02 seconds === ==============================================================================
11921
+ ============================================================================== 2 passed in 0.02 seconds ==============================================================================
11897
11922
</ pre >
11898
11923
</ div >
11899
11924
</ div >
@@ -11961,7 +11986,7 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
11961
11986
11962
11987
11963
11988
< div class ="output_subarea output_stream output_stdout output_text ">
11964
- < pre > =================================================================================== test session starts === =================================================================================
11989
+ < pre > ================================================================================ test session starts =================================================================================
11965
11990
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
11966
11991
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
11967
11992
plugins: nbval-0.9.0
@@ -11974,12 +11999,12 @@ <h2 id="pytest.mark.usefixtures"><a href="https://docs.pytest.org/en/latest/fixt
11974
11999
here we use also other_fixture which returns: FOO
11975
12000
.
11976
12001
11977
- ===================================================================================== warnings summary === ==================================================================================
12002
+ ================================================================================== warnings summary ==================================================================================
11978
12003
None
11979
12004
Module already imported so cannot be rewritten: nbval
11980
12005
11981
12006
-- 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 ========================================================================
11983
12008
</ pre >
11984
12009
</ div >
11985
12010
</ div >
@@ -12068,20 +12093,20 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
12068
12093
12069
12094
12070
12095
< div class ="output_subarea output_stream output_stdout output_text ">
12071
- < pre > =================================================================================== test session starts === =================================================================================
12096
+ < pre > ================================================================================ test session starts =================================================================================
12072
12097
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12073
12098
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12074
12099
plugins: nbval-0.9.0
12075
12100
collected 2 items
12076
12101
12077
12102
pytest_fixtures.py ..
12078
12103
12079
- ===================================================================================== warnings summary === ==================================================================================
12104
+ ================================================================================== warnings summary ==================================================================================
12080
12105
None
12081
12106
Module already imported so cannot be rewritten: nbval
12082
12107
12083
12108
-- 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 ========================================================================
12085
12110
</ pre >
12086
12111
</ div >
12087
12112
</ div >
@@ -12162,7 +12187,7 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
12162
12187
12163
12188
12164
12189
< div class ="output_subarea output_stream output_stdout output_text ">
12165
- < pre > =================================================================================== test session starts === =================================================================================
12190
+ < pre > ================================================================================ test session starts =================================================================================
12166
12191
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12167
12192
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12168
12193
plugins: nbval-0.9.0
@@ -12172,12 +12197,12 @@ <h3 id="monkeypatch"><a href="https://docs.pytest.org/en/latest/reference.html#_
12172
12197
This is modified truth
12173
12198
.
12174
12199
12175
- ===================================================================================== warnings summary === ==================================================================================
12200
+ ================================================================================== warnings summary ==================================================================================
12176
12201
None
12177
12202
Module already imported so cannot be rewritten: nbval
12178
12203
12179
12204
-- 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 ========================================================================
12181
12206
</ pre >
12182
12207
</ div >
12183
12208
</ div >
@@ -12239,20 +12264,20 @@ <h3 id="tmpdir"><a href="https://docs.pytest.org/en/latest/tmpdir.html#the-tmpdi
12239
12264
12240
12265
12241
12266
< div class ="output_subarea output_stream output_stdout output_text ">
12242
- < pre > =================================================================================== test session starts === =================================================================================
12267
+ < pre > ================================================================================ test session starts =================================================================================
12243
12268
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12244
12269
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12245
12270
plugins: nbval-0.9.0
12246
12271
collected 1 item
12247
12272
12248
12273
pytest_fixtures.py .
12249
12274
12250
- ===================================================================================== warnings summary === ==================================================================================
12275
+ ================================================================================== warnings summary ==================================================================================
12251
12276
None
12252
12277
Module already imported so cannot be rewritten: nbval
12253
12278
12254
12279
-- 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 ========================================================================
12256
12281
</ pre >
12257
12282
</ div >
12258
12283
</ div >
@@ -12321,7 +12346,7 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
12321
12346
12322
12347
12323
12348
< div class ="output_subarea output_stream output_stdout output_text ">
12324
- < pre > =================================================================================== test session starts === =================================================================================
12349
+ < pre > ================================================================================ test session starts =================================================================================
12325
12350
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12326
12351
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12327
12352
plugins: nbval-0.9.0
@@ -12337,12 +12362,12 @@ <h2 id="Fixture-scope">Fixture scope<a class="anchor-link" href="#Fixture-scope"
12337
12362
func
12338
12363
.
12339
12364
12340
- ===================================================================================== warnings summary === ==================================================================================
12365
+ ================================================================================== warnings summary ==================================================================================
12341
12366
None
12342
12367
Module already imported so cannot be rewritten: nbval
12343
12368
12344
12369
-- 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 ========================================================================
12346
12371
</ pre >
12347
12372
</ div >
12348
12373
</ div >
@@ -12403,7 +12428,7 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
12403
12428
12404
12429
12405
12430
< div class ="output_subarea output_stream output_stdout output_text ">
12406
- < pre > =================================================================================== test session starts === =================================================================================
12431
+ < pre > ================================================================================ test session starts =================================================================================
12407
12432
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12408
12433
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12409
12434
plugins: nbval-0.9.0
@@ -12416,12 +12441,12 @@ <h2 id="Setup-teardown-behaviour">Setup-teardown behaviour<a class="anchor-link"
12416
12441
this will be run after test execution, you can do e.g. some clean up here
12417
12442
12418
12443
12419
- ===================================================================================== warnings summary === ==================================================================================
12444
+ ================================================================================== warnings summary ==================================================================================
12420
12445
None
12421
12446
Module already imported so cannot be rewritten: nbval
12422
12447
12423
12448
-- 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 ========================================================================
12425
12450
</ pre >
12426
12451
</ div >
12427
12452
</ div >
@@ -12481,7 +12506,7 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
12481
12506
12482
12507
12483
12508
< div class ="output_subarea output_stream output_stdout output_text ">
12484
- < pre > =================================================================================== test session starts === =================================================================================
12509
+ < pre > ================================================================================ test session starts =================================================================================
12485
12510
platform darwin -- Python 3.5.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
12486
12511
rootdir: /Users/jerry/github/jerry-git/learn-python3, inifile: pytest.ini
12487
12512
plugins: nbval-0.9.0
@@ -12493,12 +12518,12 @@ <h2 id="Using-fixtures-automatically">Using fixtures automatically<a class="anch
12493
12518
using my_fixture
12494
12519
.
12495
12520
12496
- ===================================================================================== warnings summary === ==================================================================================
12521
+ ================================================================================== warnings summary ==================================================================================
12497
12522
None
12498
12523
Module already imported so cannot be rewritten: nbval
12499
12524
12500
12525
-- 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 ========================================================================
12502
12527
</ pre >
12503
12528
</ div >
12504
12529
</ div >
0 commit comments