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