kopia lustrzana https://github.com/jupyterhub/repo2docker
Use pytest's capsys to test for stdout values
Works better with pytest's output capturing systempull/496/head
rodzic
a9f45e6fae
commit
3a85fb814b
|
@ -6,18 +6,15 @@ import pytest
|
||||||
import logging
|
import logging
|
||||||
from repo2docker.__main__ import make_r2d
|
from repo2docker.__main__ import make_r2d
|
||||||
from repo2docker import __version__
|
from repo2docker import __version__
|
||||||
from contextlib import redirect_stdout
|
|
||||||
import io
|
|
||||||
|
|
||||||
def test_version():
|
|
||||||
|
def test_version(capsys):
|
||||||
"""
|
"""
|
||||||
Test passing '--version' to repo2docker
|
Test passing '--version' to repo2docker
|
||||||
"""
|
"""
|
||||||
stdout = io.StringIO()
|
with pytest.raises(SystemExit):
|
||||||
with redirect_stdout(stdout):
|
make_r2d(['--version'])
|
||||||
with pytest.raises(SystemExit):
|
assert capsys.readouterr().out == f"{__version__}\n"
|
||||||
make_r2d(['--version'])
|
|
||||||
assert stdout.getvalue().strip() == __version__
|
|
||||||
|
|
||||||
def test_simple():
|
def test_simple():
|
||||||
"""
|
"""
|
||||||
|
|
Ładowanie…
Reference in New Issue