Repository: timothycrosley/isort (python)

Issue:
"multi_line_output = 6" generates invalid syntax
With "multi_line_output = 6" isort generates something like: 

    from a import x y z

which is not a valid import and will raise a SyntaxError. The commas are missing. With that it should be:

    from a import x, y, z

After reading the docs:
https://docs.python.org/2/reference/simple_stmts.html#import
https://docs.python.org/3/reference/simple_stmts.html#import
the comma is mandatory in all cases if there are more than one identifiers after import.

The version I use is 4.2.2 with python 2.7.

Pull request description:
Fix invalid syntax for noqa output
Will fix #389 

Patch:
diff --git a/isort/isort.py b/isort/isort.py
index cc956eb1..90dcd72f 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -605,7 +605,7 @@ class SortImports(object):
         return self._output_vertical_grid_common(statement, imports, white_space, indent, line_length, comments) + "\n)"
 
     def _output_noqa(self, statement, imports, white_space, indent, line_length, comments):
-        retval = '{0}{1}'.format(statement, ' '.join(imports))
+        retval = '{0}{1}'.format(statement, ', '.join(imports))
         comment_str = ' '.join(comments)
         if comments:
             if len(retval) + 4 + len(comment_str) <= line_length:


Test patch:
diff --git a/test_isort.py b/test_isort.py
index 06c06ca3..878680ad 100644
--- a/test_isort.py
+++ b/test_isort.py
@@ -347,7 +347,7 @@ def test_output_modes():
 
     output_noqa = SortImports(file_contents=REALLY_LONG_IMPORT_WITH_COMMENT,
                               multi_line_output=WrapModes.NOQA).output
-    assert output_noqa == "from third_party import lib1 lib2 lib3 lib4 lib5 lib6 lib7 lib8 lib9 lib10 lib11 lib12 lib13 lib14 lib15 lib16 lib17 lib18 lib20 lib21 lib22  # NOQA comment\n"  # NOQA
+    assert output_noqa == "from third_party import lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9, lib10, lib11, lib12, lib13, lib14, lib15, lib16, lib17, lib18, lib20, lib21, lib22  # NOQA comment\n"  # NOQA
 
 
 def test_qa_comment_case():