Python sys._called_from_test() Examples

The following are 14 code examples of sys._called_from_test(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sys , or try the search function .
Example #1
Source File: _utils.py    From dcor with MIT License 7 votes vote down vote up
def _jit(function):
    """
    Compile a function using a jit compiler.

    The function is always compiled to check errors, but is only used outside
    tests, so that code coverage analysis can be performed in jitted functions.

    The tests set sys._called_from_test in conftest.py.

    """
    import sys

    compiled = numba.jit(function)

    if hasattr(sys, '_called_from_test'):
        return function
    else:  # pragma: no cover
        return compiled 
Example #2
Source File: testsupport_new.py    From wxGlade with MIT License 6 votes vote down vote up
def setUpClass(cls):
        "Initialise parts of wxGlade before individual tests starts"
        # set icon path back to the default default
        #config.icons_path = 'icons'

        # initialise wxGlade preferences and set some useful values
        common.init_preferences()
        config.preferences.autosave = False
        config.preferences.write_timestamp = False
        config.preferences.show_progress = False
        #config.version = '"faked test version"'

        # make e.g. the preview raise Exceptions
        config.testing = True

        # Determinate case and output directory
        cls.caseDirectory = os.path.join( os.path.dirname(__file__), cls.caseDirectory )
        cls.outDirectory  = os.path.join( os.path.dirname(__file__), cls.outDirectory )
        if not os.path.exists(cls.outDirectory): os.mkdir(cls.outDirectory)

        # disable bug dialogs
        sys._called_from_test = True 
Example #3
Source File: conftest.py    From datasette with Apache License 2.0 5 votes vote down vote up
def pytest_configure(config):
    import sys

    sys._called_from_test = True 
Example #4
Source File: conftest.py    From mindpark with GNU General Public License v3.0 5 votes vote down vote up
def pytest_configure(config):
    sys._called_from_test = True 
Example #5
Source File: conftest.py    From dcor with MIT License 5 votes vote down vote up
def pytest_configure(config):
    import sys
    sys._called_from_test = True 
Example #6
Source File: conftest.py    From pyq with Apache License 2.0 5 votes vote down vote up
def pytest_configure(config):
    """set pytest sentinel"""
    import sys
    sys._called_from_test = True 
Example #7
Source File: conftest.py    From vorta with GNU General Public License v3.0 5 votes vote down vote up
def pytest_configure(config):
    sys._called_from_test = True 
Example #8
Source File: conftest.py    From dtale with GNU Lesser General Public License v2.1 5 votes vote down vote up
def pytest_configure(config):
    import sys

    sys._called_from_test = True 
Example #9
Source File: conftest.py    From rhea with MIT License 5 votes vote down vote up
def pytest_configure(config):
    sys._called_from_test = True 
Example #10
Source File: conftest.py    From statsnba-playbyplay with MIT License 5 votes vote down vote up
def pytest_configure(config):
    sys._called_from_test = True 
Example #11
Source File: conftest.py    From python-mip with Eclipse Public License 2.0 5 votes vote down vote up
def pytest_configure(config):
    import sys
    sys._called_from_test = True 
Example #12
Source File: conftest.py    From python-mip with Eclipse Public License 2.0 5 votes vote down vote up
def pytest_unconfigure(config):
    if hasattr(sys, '_called_from_test'):
        del sys._called_from_test 
Example #13
Source File: testing.py    From QCFractal with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def pytest_configure(config):
    import sys

    sys._called_from_test = True
    config.addinivalue_line("markers", "example: Mark a given test as an example which can be run")
    config.addinivalue_line(
        "markers", "slow: Mark a given test as slower than most other tests, needing a special " "flag to run."
    ) 
Example #14
Source File: conftest.py    From homematicip-rest-api with GNU General Public License v3.0 5 votes vote down vote up
def pytest_configure(config):
    import sys

    sys._called_from_test = True