示例#1
0
 def test_repo_create(self, *args):
     bundles = ("bundle1", "bundle2")
     r = Repository.create(self.tmpdir)
     for bundle in bundles:
         mkdir(join(r.bundles_dir, bundle))
     r.populate_from_path(self.tmpdir)
     self.assertEqual(
         set(r.bundle_names),
         set(bundles),
     )
示例#2
0
 def test_with_custom(self):
     r = Repository.create(self.tmpdir)
     with open(join(r.items_dir, "good1.py"), 'w') as f:
         f.write("from bundlewrap.items import Item\n"
                 "class GoodTestItem(Item): bad = False\n")
     with open(join(r.items_dir, "_bad1.py"), 'w') as f:
         f.write("from bundlewrap.items import Item\n"
                 "class BadTestItem(Item): bad = True\n")
     with open(join(r.items_dir, "bad2.py"), 'w') as f:
         f.write("from bundlewrap.items import Item\n"
                 "class _BadTestItem(Item): bad = True\n")
     r.populate_from_path(self.tmpdir)
     self.assertGreater(len(r.item_classes), 0)
     for cls in r.item_classes:
         if hasattr(cls, 'bad'):
             self.assertFalse(cls.bad)
         self.assertTrue(issubclass(cls, Item))