mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-12 07:44:16 +00:00
Fix tests on Windows
The tests were failing on Windows. On Windows, the jobs argument never gets converted to an int (engine.get_style_guide line 133) This resulted in AssertionError '2' != 2. So, do the int conversion in the test. Also, on Winddows, the call count is always 0, no matter the jobs argument.
This commit is contained in:
parent
bc18d8e2d1
commit
a9f375aa93
1 changed files with 10 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ except ImportError:
|
||||||
import mock # < PY33
|
import mock # < PY33
|
||||||
|
|
||||||
from flake8 import engine
|
from flake8 import engine
|
||||||
|
from flake8.util import is_windows
|
||||||
|
|
||||||
|
|
||||||
class IntegrationTestCase(unittest.TestCase):
|
class IntegrationTestCase(unittest.TestCase):
|
||||||
|
|
@ -41,8 +42,15 @@ class IntegrationTestCase(unittest.TestCase):
|
||||||
# mock stdout.flush so we can count the number of jobs created
|
# mock stdout.flush so we can count the number of jobs created
|
||||||
with mock.patch('sys.stdout.flush') as mocked:
|
with mock.patch('sys.stdout.flush') as mocked:
|
||||||
guide, report = self.check_files(arglist=['--jobs=%s' % jobs])
|
guide, report = self.check_files(arglist=['--jobs=%s' % jobs])
|
||||||
self.assertEqual(guide.options.jobs, jobs)
|
if is_windows():
|
||||||
self.assertEqual(mocked.call_count, jobs)
|
# The code path where guide.options.jobs gets converted to an
|
||||||
|
# int is not run on windows. So, do the int conversion here.
|
||||||
|
self.assertEqual(int(guide.options.jobs), jobs)
|
||||||
|
# On windows, call count is always zero.
|
||||||
|
self.assertEqual(mocked.call_count, 0)
|
||||||
|
else:
|
||||||
|
self.assertEqual(guide.options.jobs, jobs)
|
||||||
|
self.assertEqual(mocked.call_count, jobs)
|
||||||
|
|
||||||
def test_jobs(self):
|
def test_jobs(self):
|
||||||
self._job_tester(2)
|
self._job_tester(2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue