def test_subproject_activation_updates_sample_annotations_path(conf_file):
     """ Subproject's sample annotation file pointer replaces original. """
     with mock.patch("peppy.project.Project.parse_sample_sheet"):
         p = Project(conf_file)
         p.activate_subproject(_SP_NAME)
     _, anns_file = os.path.split(p[METADATA_KEY][NAME_TABLE_ATTR])
     assert _CHILD_ANNS == anns_file
 def test_subproject_activation_updates_sample_annotations_path(conf_file):
     """ Subproject's sample annotation file pointer replaces original. """
     with mock.patch(SHEET_PARSE_FUNCPATH):
         p = Project(conf_file)
         p.activate_subproject(_SP_NAME)
     _, anns_file = os.path.split(p[METADATA_KEY][NAME_TABLE_ATTR])
     assert _CHILD_ANNS == anns_file
 def test_relative_path_metadata_stasis(self, conf_file, eq_attr):
     """ Key metadata paths are preserved with subproject that doesn't alter them. """
     with mock.patch(SHEET_PARSE_FUNCPATH):
         p = Project(conf_file)
     main_path = getattr(p, eq_attr)
     with mock.patch(SHEET_PARSE_FUNCPATH):
         sub = p.activate_subproject(_SP_NAME)
     assert main_path == getattr(sub, eq_attr)
Esempio n. 4
0
 def test_sp_act_preserves_nonoverlapping_entries(self, tmpdir, super_data,
                                                  sub_data, preserved):
     """ Existing entries not in subproject should be kept as-is. """
     sp = "sub"
     meta_key = METADATA_KEY
     conf_data = {
         meta_key: super_data,
         SUBPROJECTS_SECTION: {
             sp: {
                 meta_key: sub_data
             }
         }
     }
     conf_file = tmpdir.join("conf.yaml").strpath
     with open(conf_file, 'w') as f:
         yaml.dump(conf_data, f)
     p = Project(conf_file)
     originals = [(k, p[meta_key][k]) for k in preserved]
     print("INITIAL METADATA: {}".format(p.metadata))
     p = p.activate_subproject(sp)
     print("UPDATED METADATA: {}".format(p.metadata))
     for k, v in originals:
         assert v == p[meta_key][k]