def test_read_cached_file(self, mocker, filename): utils.preload_resources() m = mocker.patch('pkg_resources.resource_string') utils.read_file(filename) m.assert_not_called()
def test_readfile_binary(self): """Read a test file in binary mode.""" content = utils.read_file(os.path.join('utils', 'testfile'), binary=True) assert content.splitlines()[0] == b"Hello World!"
def test_readfile(self): """Read a test file.""" content = utils.read_file(os.path.join('utils', 'testfile')) assert content.splitlines()[0] == "Hello World!"
def test_read_cached_file(self, mocker, filename): utils.preload_resources() m = mocker.patch('qutebrowser.utils.utils.importlib_resources.files') utils.read_file(filename) m.assert_not_called()