summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter.py1
-rw-r--r--pato2.py2
-rw-r--r--test/blacklist_sample2
-rw-r--r--test/test_pkginfo_from_rsync_output.py17
4 files changed, 14 insertions, 8 deletions
diff --git a/filter.py b/filter.py
index f8182e3..f91ec68 100644
--- a/filter.py
+++ b/filter.py
@@ -107,7 +107,6 @@ def generate_exclude_list_from_blacklist(packages_iterable, blacklisted_names,
a.append(package["location"])
if debug:
- printf(a)
return a
try:
fsock = open(exclude_file,"w")
diff --git a/pato2.py b/pato2.py
index e32a4dd..5bc97a9 100644
--- a/pato2.py
+++ b/pato2.py
@@ -42,7 +42,7 @@ def listado(filename_):
archivo = open(filename_,"r")
lista = archivo.read().split("\n")
archivo.close()
- return [pkg.split(":")[0] for pkg in lista if pkg]
+ return [pkg.split(":")[0].rstrip() for pkg in lista if pkg]
def db(repo_,arch_):
"""Construye un nombre para sincronizar una base de datos."""
diff --git a/test/blacklist_sample b/test/blacklist_sample
new file mode 100644
index 0000000..2a02af6
--- /dev/null
+++ b/test/blacklist_sample
@@ -0,0 +1,2 @@
+alex:alex-libre: AquĆ­ va un comentario
+gmime22 ::Non free dependencies \ No newline at end of file
diff --git a/test/test_pkginfo_from_rsync_output.py b/test/test_pkginfo_from_rsync_output.py
index 5ed5dd8..aca49e8 100644
--- a/test/test_pkginfo_from_rsync_output.py
+++ b/test/test_pkginfo_from_rsync_output.py
@@ -47,14 +47,19 @@ class pkginfoFromRsyncOutput(unittest.TestCase):
self.assertIsInstance(pkg,Package)
def testPackageInfo(self):
- if self.pkglist:
- first_package=self.pkglist[0]
- else:
- self.fail(self.pkglist)
- self.assertEqual(first_package,example_package_list[0])
+ if not self.pkglist:
+ self.fail("Pkglist doesn't exist: " + str(self.pkglist))
+ self.assertEqual(self.pkglist,example_package_list)
class generateRsyncBlacklist(unittest.TestCase):
""" Test Blacklist generation """
-
+ def testListado(self):
+ self.assertEqual(listado("blacklist_sample"),["alex","gmime22"])
+
+ def testExcludeFiles(self):
+ a=generate_exclude_list_from_blacklist(example_package_list,listado("blacklist_sample"),debug=True)
+ b=[example_package_list[0]["location"],example_package_list[2]["location"]]
+ self.assertEqual(a,b)
+
if __name__ == "__main__":
unittest.main()