File: fixtures.py

package info (click to toggle)
exhale 0.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,616 kB
  • sloc: python: 9,057; cpp: 1,260; javascript: 915; f90: 29; ansic: 18; makefile: 16
file content (36 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf8 -*-
########################################################################################
# This file is part of exhale.  Copyright (c) 2017-2024, Stephen McDowell.             #
# Full BSD 3-Clause license available here:                                            #
#                                                                                      #
#                https://github.com/svenevs/exhale/blob/master/LICENSE                 #
########################################################################################
"""
Provides fixtures to be available for all test cases.
"""
from __future__ import unicode_literals
from exhale import deploy
import pytest


@pytest.fixture(scope="class")
def no_run():
    """
    Disable :func:`exhale.deploy.explode` using a class-level ``pytest`` `fixture`__.

    __ https://docs.pytest.org/en/latest/explanation/fixtures.html

    The fixture will temporarily assign ``lambda: None`` to ``deploy.explode``,
    restoring the original function after the test case has completed.  A class-scoped
    fixture is used so that this fixture is generated **before** others.

    .. See :func:`pytest:_pytest.FixtureManager.getfixtureclosure`.

    Search for ``def getfixtureclosure`` on `this page`__.

    __ https://docs.pytest.org/en/latest/_modules/_pytest/fixtures.html
    """
    explode = deploy.explode
    deploy.explode = lambda: None
    yield
    deploy.explode = explode