Last active
May 8, 2020 16:43
-
-
Save hakib/a10f1ac7fcce6505865ae6ac7daeb686 to your computer and use it in GitHub Desktop.
Revisions
-
hakib revised this gist
Dec 17, 2019 . 1 changed file with 40 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,16 +12,52 @@ def B(): # What I can do def test_A_is_one(A): assert A == 1 def test_B_is_one(B): assert B == 1 # What I want to do @pytest.mark.parametrize('foo', [A, B]) def test_is_one(foo): assert foo == 1 """ $ pytest test.py ==================================================================================== test session starts ===================================================================================== platform linux -- Python 3.7.5, pytest-5.3.0, py-1.8.0, pluggy-0.13.0 Django settings: conf.settings (from ini file) rootdir: /home/haki/src/ravkav-store/server, inifile: pytest.ini plugins: django-3.5.1 collected 4 items test.py ..FF [100%] ========================================================================================== FAILURES ========================================================================================== _______________________________________________________________________________________ test_is_one[A] _______________________________________________________________________________________ foo = <function A at 0x7f93f51c9d40> @pytest.mark.parametrize('foo', [A, B]) def test_is_one(foo): > assert foo == 1 E assert <function A at 0x7f93f51c9d40> == 1 test.py:27: AssertionError _______________________________________________________________________________________ test_is_one[B] _______________________________________________________________________________________ foo = <function B at 0x7f93f51c9e60> @pytest.mark.parametrize('foo', [A, B]) def test_is_one(foo): > assert foo == 1 E assert <function B at 0x7f93f51c9e60> == 1 test.py:27: AssertionError ================================================================================ 2 failed, 2 passed in 0.09s ================================================================================= """ -
hakib revised this gist
Dec 17, 2019 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,20 @@ def A(): def B(): return 1 # What I can do def A_is_one(A): assert A == 1 def B_is_one(B): assert B == 1 # What I want to do @pytest.mark.parametrize('foo', [A, B]) def is_one(foo): assert foo == 1 -
hakib created this gist
Dec 17, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ import pytest @pytest.fixture def A(): return 1 @pytest.fixture def B(): return 1 @pytest.mark.parametrize('foo', [A, B]) def is_one(foo): assert foo == 1