How to use the pyfakefs.fake_filesystem_glob.FakeGlobModule function in pyfakefs

To help you get started, we’ve selected a few pyfakefs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SUSE / DeepSea / tests / unit / _modules / test_osd.py View on Github external
def test_readlink_samename(self, mock_time):
        osd.__salt__ = {}
        osd.__salt__['helper.run'] = mock.Mock()
        osd.__salt__['helper.run'].return_value = ('', '/dev/disk/by-id/wwn-0x12345-part1', '')
        result = osd.readlink("/dev/disk/by-id/wwn-0x12345-part1")

        assert result == "/dev/disk/by-id/wwn-0x12345-part1"



@pytest.mark.skip(reason="Low priority: skipped")
class TetstOSDState():
    pass

fs = fake_fs.FakeFilesystem()
f_glob = fake_glob.FakeGlobModule(fs)
f_os = fake_fs.FakeOsModule(fs)
f_open = fake_fs.FakeFileOpen(fs)

class TestOSDWeight():
    """
    Initial checks for the wait method.  Override the __init__ funciton to
    avoid the rados logic.  Set osd_id and settings directly.
    """

    @patch('builtins.open', new=f_open)
    @patch('srv.salt._modules.osd.OSDWeight.osd_df')
    def test_save_defaults(self, osd_df):
        """
        No files created with default values
        """
        osd_df.return_value = {'crush_weight': 0,