mockfs.replace_builtins

Here are the examples of the python api mockfs.replace_builtins taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

8 Examples 7

Example 1

Project: jasmine-py
Source File: entry_points_test.py
View license
@pytest.fixture
def mockfs_with_config(request):
    mfs = replace_builtins()
    mfs.add_entries({
        "/spec/javascripts/support/jasmine.yml": """
        src_dir: src
        spec_dir: spec
        """
    })
    request.addfinalizer(lambda: restore_builtins())
    return mfs

Example 2

Project: jasmine-py
Source File: config_test.py
View license
@pytest.fixture
def fs(request):
    mfs = mockfs.replace_builtins()

    os.path.lexists = mfs.exists
    glob.iglob = mfs.glob

    mfs.add_entries({
        "jasmine.yml": """
            src_files:
              - src/player.js
              - src/**/*.js
              - http://cdn.jquery.com/jquery.js
              - vendor/test.js
              - vendor/**/*.{js,coffee}
            """,
        "/spec/javascripts/helpers/spec_helper.js": '',
        "/lib/jams/jam_spec.js": '',
        "/src/player.js": '',
        "/src/mixer/mixer.js": '',
        "/src/tuner/fm/fm_tuner.js": '',
        "/spec/javascripts/player_spec.js": '',
        "/spec/javascripts/mixer/mixer_spec.js": '',
        "/spec/javascripts/tuner/fm/fm_tuner_spec.js": '',
        "/spec/javascripts/tuner/am/AMSpec.js": '',
        "/vendor/test.js": '',
        "/vendor/pants.coffee": '',
        "/vendor_spec/pantsSpec.js": '',
        "/main.css": '',
    })

    request.addfinalizer(lambda: mockfs.restore_builtins())

    return mfs

Example 3

Project: jasmine-py
Source File: entry_points_test.py
View license
@pytest.fixture
def mockfs(request):
    mfs = replace_builtins()
    request.addfinalizer(lambda: restore_builtins())
    return mfs

Example 4

Project: jasmine-py
Source File: standalone_test.py
View license
@pytest.fixture
def mockfs(request):
    mfs = replace_builtins()
    request.addfinalizer(lambda: restore_builtins())
    return mfs

Example 5

Project: mockfs
Source File: mockfs_test.py
View license
    def setUp(self):
        self.mfs = mockfs.replace_builtins()

Example 6

Project: mockfs
Source File: mockfs_test.py
View license
    def setUp(self):
        self.mfs = mockfs.replace_builtins()

Example 7

Project: mockfs
Source File: storage_test.py
View license
    def setUp(self):
        self.mfs = mockfs.replace_builtins()

Example 8

Project: mockfs
Source File: storage_test.py
View license
    def setUp(self):
        self.mfs = mockfs.replace_builtins()