Ejemplo n.º 1
0
def simple_parse(example_fomod):
    """
    A simple parse of valid fomod files.
    Returns an *info*, *config* tuple.
    """
    fomod_files = io.get_installer_files(example_fomod)
    info = etree.parse(fomod_files[0], parser=parser.FOMOD_PARSER).getroot()
    config = etree.parse(fomod_files[1], parser=parser.FOMOD_PARSER).getroot()
    return info, config
Ejemplo n.º 2
0
 def test_empty(self, tmpdir):
     with pytest.raises(IOError):
         # mimic a package that does not contain a fomod folder
         io.get_installer_files(str(tmpdir))
Ejemplo n.º 3
0
 def test_valid(self, example_fomod):
     fomod_path = os.path.join(example_fomod, 'fomod')
     base_files = io.get_installer_files(example_fomod)
     fomod_files = io.get_installer_files(fomod_path)
     assert base_files == fomod_files
Ejemplo n.º 4
0
 def test_missing_config(self, example_fomod, tmpdir):
     copy_tree(example_fomod, str(tmpdir))
     config_path = os.path.join(str(tmpdir), 'fomod', 'ModuleConfig.xml')
     os.remove(config_path)
     with pytest.raises(IOError):
         io.get_installer_files(str(tmpdir))
Ejemplo n.º 5
0
 def test_missing_info(self, example_fomod, tmpdir):
     copy_tree(example_fomod, str(tmpdir))
     info_path = os.path.join(str(tmpdir), 'fomod', 'info.xml')
     os.remove(info_path)
     with pytest.raises(IOError):
         io.get_installer_files(str(tmpdir))
Ejemplo n.º 6
0
 def test_no_fomod_folder(self, tmpdir):
     # mimic a fake path
     fake_path = os.path.join(str(tmpdir), 'fomod')
     with pytest.raises(IOError):
         io.get_installer_files(fake_path)