mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +00:00
Added test demonstrating issue #39
This commit is contained in:
parent
ea456614b5
commit
da2b0b8a43
1 changed files with 38 additions and 0 deletions
38
flake8/tests/test_main.py
Normal file
38
flake8/tests/test_main.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
from __future__ import with_statement
|
||||
|
||||
import unittest
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock # < PY33
|
||||
|
||||
import setuptools
|
||||
from flake8 import main
|
||||
|
||||
|
||||
class TestMain(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.patches = {}
|
||||
|
||||
def tearDown(self):
|
||||
assert len(self.patches.items()) == 0
|
||||
|
||||
def start_patch(self, patch):
|
||||
self.patches[patch] = mock.patch(patch)
|
||||
return self.patches[patch].start()
|
||||
|
||||
def stop_patches(self):
|
||||
patches = self.patches.copy()
|
||||
for k, v in patches.items():
|
||||
v.stop()
|
||||
del(self.patches[k])
|
||||
|
||||
def test_issue_39_regression(self):
|
||||
distribution = setuptools.Distribution()
|
||||
cmd = main.Flake8Command(distribution)
|
||||
cmd.options_dict = {}
|
||||
cmd.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue