From 107afcc6f23e6efcd2f666712b5011ab9ac62f08 Mon Sep 17 00:00:00 2001 From: Vadim Kravcenko Date: Tue, 12 May 2015 06:33:07 +0200 Subject: [PATCH] fix tests --- tests/test_pipreqs.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/test_pipreqs.py b/tests/test_pipreqs.py index d216bfc..aaed0ff 100755 --- a/tests/test_pipreqs.py +++ b/tests/test_pipreqs.py @@ -18,8 +18,9 @@ class TestPipreqs(unittest.TestCase): def setUp(self): self.modules = ['flask', 'requests', 'sqlalchemy', - 'docopt', 'boto', 'ipython', 'pyflakes', 'nose', 'peewee', 'ujson', 'nonexistendmodule', 'bs4',] + 'docopt', 'boto', 'ipython', 'pyflakes', 'nose', 'peewee', 'ujson', 'nonexistendmodule', 'bs4', ] self.modules2 = ['beautifulsoup4'] + self.local = ["docopt", "requests"] self.project = os.path.join(os.path.dirname(__file__), "_data") self.requirements_path = os.path.join(self.project, "requirements.txt") self.alt_requirement_path = os.path.join( @@ -50,7 +51,9 @@ class TestPipreqs(unittest.TestCase): def test_get_use_local_only(self): # should find only docopt and requests imports_with_info = pipreqs.get_import_local(self.modules) - self.assertEqual(len(imports_with_info), 2) + print(imports_with_info) + for item in imports_with_info: + self.assertTrue(item['name'].lower() in self.local) def test_init(self): pipreqs.init( @@ -66,8 +69,10 @@ class TestPipreqs(unittest.TestCase): {'': self.project, '--savepath': None, '--use-local': True}) assert os.path.exists(self.requirements_path) == 1 with open(self.requirements_path, "r") as f: - self.assertEqual( - len(f.readlines()), 2, 'Only two local packages should be found') + data = f.read().lower() + print(data) + for item in self.local: + self.assertTrue(item.lower() in data) def test_init_savepath(self): pipreqs.init({'': self.project, '--savepath':