Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Oct 18, 2024
1 parent 48224c5 commit be62554
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/fixtures/class_fixture_return/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@


@pytest.fixture(scope='class')
def mocked_config():
def class_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
# limitations under the License.

class TestClassOne:
def test_fixture_class_setup_first(self, mocked_config):
assert mocked_config is not None
def test_fixture_class_setup_first(self, class_fixture_return_config):
assert class_fixture_return_config is not None

def test_fixture_class_setup_second(self, mocked_config):
assert mocked_config is not None
def test_fixture_class_setup_second(self, class_fixture_return_config):
assert class_fixture_return_config is not None


class TestClassTwo:
def test_fixture_class_setup_forth(self, mocked_config):
assert mocked_config is not None
def test_fixture_class_setup_forth(self, class_fixture_return_config):
assert class_fixture_return_config is not None

def test_fixture_class_setup_fifth(self, mocked_config):
assert mocked_config is not None
def test_fixture_class_setup_fifth(self, class_fixture_return_config):
assert class_fixture_return_config is not None
2 changes: 1 addition & 1 deletion examples/fixtures/module_fixture_return/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@


@pytest.fixture(scope='module')
def mocked_config():
def module_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def test_fixture_module_setup_first(mocked_config):
assert mocked_config is not None
def test_fixture_module_setup_first(module_fixture_return_config):
assert module_fixture_return_config is not None


def test_fixture_module_setup_second(mocked_config):
assert mocked_config is not None
def test_fixture_module_setup_second(module_fixture_return_config):
assert module_fixture_return_config is not None
2 changes: 1 addition & 1 deletion examples/fixtures/package_fixture_return/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@


@pytest.fixture(scope='package')
def mocked_config():
def package_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def test_fixture_package_setup_first(mocked_config):
assert mocked_config is not None
def test_fixture_package_setup_first(package_fixture_return_config):
assert package_fixture_return_config is not None
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def test_fixture_package_setup_second(mocked_config):
assert mocked_config is not None
def test_fixture_package_setup_second(package_fixture_return_config):
assert package_fixture_return_config is not None
2 changes: 1 addition & 1 deletion examples/fixtures/session_fixture_return/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@


@pytest.fixture(scope='session')
def mocked_config():
def session_fixture_return_config():
print('setup')
return mock.Mock()
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
# limitations under the License.


def test_fixture_session_setup_first(mocked_config):
assert mocked_config is not None
def test_fixture_session_setup_first(session_fixture_return_config):
assert session_fixture_return_config is not None
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
# limitations under the License.


def test_fixture_session_setup_second(mocked_config):
assert mocked_config is not None
def test_fixture_session_setup_second(session_fixture_return_config):
assert session_fixture_return_config is not None
4 changes: 2 additions & 2 deletions examples/fixtures/test_fixture_return_none/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@


@pytest.fixture
def mocked_config():
LOGGER.warn(LOG_MESSAGE_SETUP)
def test_fixture_setup_config_none():
LOGGER.warning(LOG_MESSAGE_SETUP)
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
# limitations under the License.


def test_fixture_setup(mocked_config):
assert mocked_config is not None
def test_fixture_setup_none(test_fixture_setup_config_none):
assert test_fixture_setup_config_none is not None
2 changes: 1 addition & 1 deletion examples/fixtures/test_fixture_setup_failure/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@


@pytest.fixture
def mocked_config():
def fixture_setup_failure_config():
logging.error(LOG_MESSAGE_SETUP)
raise Exception('Fixture setup failed')
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
# limitations under the License.


def test_fixture_setup(mocked_config):
assert mocked_config is not None
def test_fixture_setup_failure(fixture_setup_failure_config):
assert fixture_setup_failure_config is not None
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


@pytest.fixture
def fixture_teardown_config():
def fixture_teardown_failure_config():
logging.error(LOG_MESSAGE_BEFORE_YIELD)
yield mock.Mock()
logging.error(LOG_MESSAGE_TEARDOWN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
from time import sleep


def test_fixture_teardown(fixture_teardown_config):
def test_fixture_teardown_failure(fixture_teardown_failure_config):
sleep(0.001)
assert fixture_teardown_config is not None
assert fixture_teardown_failure_config is not None

0 comments on commit be62554

Please sign in to comment.