diff --git a/bindep/depends.py b/bindep/depends.py index 1ed0b05..dc6b2ea 100644 --- a/bindep/depends.py +++ b/bindep/depends.py @@ -140,6 +140,9 @@ class Depends(object): :param filename: The string name of the file from which requirements were loaded. """ + if not depends_string.endswith('\n'): + # The parsley grammar expects each line to end with a newline + depends_string += '\n' parser = makeGrammar(grammar, {})(depends_string) self._rules = parser.rules() self.filename = filename diff --git a/bindep/tests/test_depends.py b/bindep/tests/test_depends.py index e090df7..4f86986 100644 --- a/bindep/tests/test_depends.py +++ b/bindep/tests/test_depends.py @@ -376,6 +376,12 @@ class TestDepends(TestCase): depends = Depends("") self.assertEqual([], depends._rules) + def test_no_newline(self): + depends = Depends("foo") + self.assertEqual( + [("foo", [], [])], + depends._rules) + def test_selectors(self): depends = Depends("foo [!bar baz quux]\n") self.assertEqual(