Cleanup: Changes suggested by @sybren

This commit is contained in:
gandalf3
2017-07-05 18:40:32 -07:00
parent 1cefb4eab6
commit f20264c963
2 changed files with 78 additions and 73 deletions

View File

@@ -10,7 +10,7 @@ import make_repo
logging.basicConfig(level=logging.DEBUG,
format='%(levelname)8s: %(message)s')
class test_make_repo(unittest.TestCase):
class TestRepoGeneration(unittest.TestCase):
helper_path = Path('tests', 'test_helpers')
addon_path = helper_path / 'addons'
@@ -20,21 +20,6 @@ class test_make_repo(unittest.TestCase):
with self.assertRaises(FileNotFoundError):
make_repo.extract_blinfo(self.addon_path / test_file)
# def test_make_repo_valid(self):
# reference_repo = make_repo.make_repo(self.helper_path / 'addons', "test repo")
# repojson = Path.cwd() / 'repo.json'
# reference_repojson = self.helper_path / 'repo.json'
#
# try:
# with repojson.open('r') as repolist_f:
# with reference_repojson.open('r') as ref_repolist_f:
# repolist = json.loads(repolist_f.read())
# ref_repolist = json.loads(ref_repolist_f.read())
# self.assertEqual(repolist, ref_repolist)
# finally:
# # repojson.unlink()
# pass
def test_package_quantity(self):
repo = make_repo.make_repo(self.addon_path, "name of the repo")
acceptible_addons = [
@@ -49,12 +34,12 @@ class test_make_repo(unittest.TestCase):
# addons which should contain bl_infos
yes_blinfo = [
f for f in test_make_repo.addon_path.iterdir()
f for f in TestRepoGeneration.addon_path.iterdir()
if not f.match('*nonaddon*') and not f.match('*invalid_addon*')
]
# addons which should throw BadAddon because they have no blinfo
no_blinfo = [
f for f in test_make_repo.addon_path.iterdir()
f for f in TestRepoGeneration.addon_path.iterdir()
if f.match('*nonaddon*')
]
@@ -81,6 +66,6 @@ def add_generated_tests(test_generator, params, destclass):
test_func = test_generator(param)
setattr(destclass, 'test_{}'.format(param), test_func)
add_generated_tests(generate_good_blinfo_test, yes_blinfo, test_make_repo)
add_generated_tests(generate_bad_blinfo_test, no_blinfo, test_make_repo)
add_generated_tests(generate_good_blinfo_test, yes_blinfo, TestRepoGeneration)
add_generated_tests(generate_bad_blinfo_test, no_blinfo, TestRepoGeneration)