Last active
April 23, 2017 10:44
-
-
Save absent1706/0139e091dda032946e1f66c286ff2031 to your computer and use it in GitHub Desktop.
pytest session fixture. run as 'pytest . -s -v'. Output will be http://www.qopy.me/CIuVG0i6QsaFy5dsIKRBKA
This file contains 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 characters
from __future__ import print_function | |
# import unittest | |
import pytest | |
@pytest.fixture(scope='session') | |
def selenium(request): | |
print('BEGIN fixture') | |
request.addfinalizer(lambda: print('END fixture')) | |
return 123 |
This file contains 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 characters
from __future__ import print_function | |
def fib(n): | |
return 1 if n<=2 else fib(n-1)+fib(n-2) | |
def test_fib_assert_equal(selenium): | |
print('begin', selenium) | |
assert fib(10) == 55 | |
print('end', selenium) | |
def test_fib_assert_true(selenium): | |
print('begin', selenium) | |
assert fib(10) == 55 | |
print('end', selenium) |
This file contains 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 characters
from __future__ import print_function | |
def fac(n): | |
return 1 if n<=2 else fac(n-1)+fac(n-2) | |
def test_fac_assert_equal(selenium): | |
print('begin', selenium) | |
assert fac(10) == 55 | |
print('end', selenium) | |
def test_fac_assert_true(selenium): | |
print('begin', selenium) | |
assert fac(10) == 55 | |
print('end', selenium) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment