Commit 50190c36 by Sébastien Eustace

Fix tests for Python 2.7

parent c70edfd7
from cleo.testers import CommandTester
from poetry.utils._compat import PY2
from poetry.utils._compat import Path
from poetry.poetry import Poetry
......@@ -26,6 +27,13 @@ def test_check_invalid(app):
tester.execute([("command", command.get_name())])
if PY2:
expected = """\
Error: u'description' is a required property
Error: INVALID is not a valid license
Warning: A wildcard Python dependency is ambiguous. Consider specifying a more explicit one.
"""
else:
expected = """\
Error: 'description' is a required property
Error: INVALID is not a valid license
......
......@@ -2,10 +2,8 @@
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from poetry.exceptions import InvalidProjectFile
from poetry.poetry import Poetry
from poetry.utils._compat import PY2
from poetry.utils._compat import Path
from poetry.utils.toml_file import TomlFile
......@@ -145,10 +143,16 @@ def test_check_fails():
complete = TomlFile(fixtures_dir / "complete.toml")
content = complete.read()["tool"]["poetry"]
content["this key is not in the schema"] = ""
assert Poetry.check(content) == {
"errors": [
if PY2:
expected = (
"Additional properties are not allowed "
"(u'this key is not in the schema' was unexpected)"
)
else:
expected = (
"Additional properties are not allowed "
"('this key is not in the schema' was unexpected)"
],
"warnings": [],
}
)
assert Poetry.check(content) == {"errors": [expected], "warnings": []}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment