Did I find the right examples for you? yes no

All Samples(16)  |  Call(11)  |  Derive(0)  |  Import(5)
Set resource file existence checking to True or False.

By default, this is set to True, so that resources that point to
non-existent files will result in an error. We recommend you keep
it at this value when using Fanstatic. An
:py:class:`UnknownResourceError` will then be raised if you
accidentally refer to a non-existent resource.

When running tests it's often useful to make fake resources that
don't really have a filesystem representation, so this is set to(more...)

        def set_resource_file_existence_checking(v):
    """Set resource file existence checking to True or False.

    By default, this is set to True, so that resources that point to
    non-existent files will result in an error. We recommend you keep
    it at this value when using Fanstatic. An
    :py:class:`UnknownResourceError` will then be raised if you
    accidentally refer to a non-existent resource.

    When running tests it's often useful to make fake resources that
    don't really have a filesystem representation, so this is set to
    False temporarily; for the Fanstatic tests this is done. Inside
    a test for this particular feature, this can temporarily be set
    to True.
    """
    global _resource_file_existence_checking
    _resource_file_existence_checking = v
        


src/f/a/fanstatic-1.0a5/tests/test_core.py   fanstatic(Download)
import pytest
 
from fanstatic import (Library,
                       Resource,
                       NeededResources,
    # non-test circumstances this is set to True, and we want to
    # test things for real here
    set_resource_file_existence_checking(True)
    foo = Library('foo', tmpdir.strpath)
    # since a.js exists, this should work

src/f/a/fanstatic-1.0a5/tests/test_compiler.py   fanstatic(Download)
from fanstatic import Library, Resource, NeededResources
from fanstatic import compat, Inclusion, MINIFIED
from fanstatic import set_resource_file_existence_checking
from fanstatic.compiler import Compiler, Minifier
from .test_checksum import _copy_testdata
def test_compiler_available_and_source_not_present_should_raise(
    tmpdir, compilers):
    compilers.add_compiler(MockCompiler())
    set_resource_file_existence_checking(True)
    lib = Library('lib', str(tmpdir))
    compiler.available = False
    compilers.add_compiler(compiler)
    set_resource_file_existence_checking(True)
    lib = Library('lib', str(tmpdir))
    # assert_nothing_raised
    # since the compiler can be used to generate the resource file
    compilers.add_compiler(MockCompiler())
    set_resource_file_existence_checking(True)
    lib = Library('lib', str(tmpdir))
    # assert_nothing_raised
    compiler.available = False
    compilers.add_compiler(compiler)
    set_resource_file_existence_checking(True)
    lib = Library('lib', str(tmpdir))
    with pytest.raises(fanstatic.UnknownResourceError) as exc:

src/f/a/fanstatic-tools-0.2/fanstatic/test_core.py   fanstatic-tools(Download)
import six
 
from fanstatic import (Library,
                       Resource,
                       NeededResources,
    # non-test circumstances this is set to True, and we want to
    # test things for real here
    set_resource_file_existence_checking(True)
    foo = Library('foo', tmpdir.strpath)
    # since a.js exists, this should work

src/f/a/fanstatic-1.0a5/tests/conftest.py   fanstatic(Download)
from fanstatic import set_resource_file_existence_checking
 
 
def pytest_runtest_setup(item):
    set_resource_file_existence_checking(False)
 
 
def pytest_runtest_teardown(item):
    set_resource_file_existence_checking(True)

src/f/a/fanstatic-tools-0.2/fanstatic/conftest.py   fanstatic-tools(Download)
from fanstatic import set_resource_file_existence_checking
 
def pytest_runtest_setup(item):
    set_resource_file_existence_checking(False)
 
def pytest_runtest_teardown(item):
    set_resource_file_existence_checking(True)