move some fill fixture acceptance tests contents to the examples script folder

This commit is contained in:
Ronny Pfannschmidt
2018-06-29 10:58:33 +02:00
parent 4ae7e9788c
commit 0fd86ec8a8
19 changed files with 170 additions and 160 deletions

View File

@@ -0,0 +1,7 @@
import pytest
@pytest.fixture
def arg1(request):
with pytest.raises(Exception):
request.getfixturevalue("arg2")

View File

@@ -0,0 +1,7 @@
import pytest
@pytest.fixture
def arg2(request):
pytest.raises(Exception, "request.getfixturevalue('arg1')")

View File

@@ -0,0 +1,6 @@
import pytest
@pytest.fixture
def spam():
return "spam"

View File

@@ -0,0 +1,6 @@
import pytest
@pytest.fixture
def spam(spam):
return spam * 2

View File

@@ -0,0 +1,2 @@
def test_spam(spam):
assert spam == "spamspam"

View File

@@ -0,0 +1,6 @@
import pytest
@pytest.fixture
def spam():
return "spam"

View File

@@ -0,0 +1,10 @@
import pytest
@pytest.fixture
def spam(spam):
return spam * 2
def test_spam(spam):
assert spam == "spamspam"

View File

@@ -0,0 +1,15 @@
import pytest
@pytest.fixture
def spam():
return "spam"
class TestSpam(object):
@pytest.fixture
def spam(self, spam):
return spam * 2
def test_spam(self, spam):
assert spam == "spamspam"

View File

@@ -0,0 +1,16 @@
import pytest
@pytest.fixture
def some(request):
return request.function.__name__
@pytest.fixture
def other(request):
return 42
def test_func(some, other):
pass

View File

@@ -0,0 +1,11 @@
import pytest
class TestClass(object):
@pytest.fixture
def something(self, request):
return request.instance
def test_method(self, something):
assert something is self

View File

@@ -0,0 +1,15 @@
import pytest
@pytest.fixture
def something(request):
return request.function.__name__
class TestClass(object):
def test_method(self, something):
assert something == "test_method"
def test_func(something):
assert something == "test_func"

View File

@@ -0,0 +1,10 @@
import pytest
@pytest.fixture
def xyzsomething(request):
return 42
def test_func(some):
pass