Commit c95a62b5 by Sébastien Eustace

Add tests

parent 253bb029
from cleo.testers import CommandTester
def test_about(app):
command = app.find('about')
tester = CommandTester(command)
tester.execute([('command', command.get_name())])
expected = """\
Poetry - Package Management for Python
Poetry is a dependency manager tracking local dependencies of your projects and libraries.
See https://github.com/sdispater/poetry for more information.
"""
assert tester.get_display() == expected
from cleo.testers import CommandTester
def test_about(app):
command = app.find('check')
tester = CommandTester(command)
tester.execute([('command', command.get_name())])
expected = """\
All set!
"""
assert tester.get_display() == expected
import pytest
from poetry.console import Application as BaseApplication
from poetry.utils._compat import Path
class Application(BaseApplication):
def __init__(self, poetry_path):
super(Application, self).__init__()
self._poetry_path = poetry_path
@property
def poetry(self):
from poetry.poetry import Poetry
if self._poetry is not None:
return self._poetry
self._poetry = Poetry.create(self._poetry_path)
return self._poetry
@pytest.fixture
def app():
return Application(
Path(__file__).parent.parent / 'fixtures' / 'sample_project'
)
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