From c17eb5fd0d64f9abfc253362edd5901473fdf67c Mon Sep 17 00:00:00 2001 From: Ann Paul Date: Sun, 8 Oct 2017 20:54:15 -0700 Subject: [PATCH] Fix tests for 3.* and 2.6 --- tests/test_pipreqs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pipreqs.py b/tests/test_pipreqs.py index 2fc65af..8bd61b7 100755 --- a/tests/test_pipreqs.py +++ b/tests/test_pipreqs.py @@ -7,7 +7,7 @@ test_pipreqs Tests for `pipreqs` module. """ -from StringIO import StringIO +from io import BytesIO import unittest import os import requests @@ -100,16 +100,16 @@ class TestPipreqs(unittest.TestCase): Test that all modules we will test upon, are written out in alphabetic order """ self.modules.extend(self.modules2) - mock, sys.stdout = sys.stdout, StringIO() + mock, sys.stdout = sys.stdout, BytesIO() pipreqs.init({'': self.project, '--savepath': None, '--print': True, '--use-local': None, '--force': True, '--proxy': None, '--pypi-server': None, '--diff': None, '--clean': None}) list_output_req = sys.stdout.getvalue().split('\n') - for idx in xrange(len(list_output_req)): + for idx in range(len(list_output_req)): name_value = list_output_req[idx].split('==') if name_value[0]: - self.assertIn(name_value[0].lower(), self.modules) + self.assertTrue(name_value[0].lower() in self.modules) sys.stdout = mock def test_init_local_only(self):