Skip to content

Commit

Permalink
Capture logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
csadorf committed Feb 17, 2022
1 parent caf5db9 commit 0ac8373
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
This is the test module for the project's command-line interface (CLI)
module.
"""
import logging

import docker
import pytest
from click.testing import CliRunner, Result
Expand Down Expand Up @@ -163,7 +165,9 @@ def test_remove_running_profile(self):
@pytest.mark.slow
@pytest.mark.trylast
class TestInstanceLifecycle:
def test_start_stop_reset(self, instance, docker_client):
def test_start_stop_reset(self, instance, docker_client, caplog):
caplog.set_level(logging.DEBUG)

def get_volume(volume_name):
try:
return docker_client.volumes.get(volume_name)
Expand All @@ -186,26 +190,22 @@ def assert_status_down():

# Start instance.
runner: CliRunner = CliRunner()
result: Result = runner.invoke(
cli.cli, ["-vvv", "start", "--no-browser", "--wait=300"]
)
result: Result = runner.invoke(cli.cli, ["start", "--no-browser", "--wait=300"])
assert result.exit_code == 0

assert_status_up()
assert get_volume(instance.profile.home_mount)
assert get_volume(instance.profile.conda_volume_name())

# Start instance again – should be noop.
result: Result = runner.invoke(
cli.cli, ["-vvv", "start", "--no-browser", "--wait=300"]
)
result: Result = runner.invoke(cli.cli, ["start", "--no-browser", "--wait=300"])
assert "Container was already running" in result.output.strip()
assert result.exit_code == 0
assert_status_up()

# Restart instance.
result: Result = runner.invoke(
cli.cli, ["-vvv", "start", "--no-browser", "--wait=600", "--restart"]
cli.cli, ["start", "--no-browser", "--wait=120", "--restart"]
)
assert result.exit_code == 0
assert_status_up()
Expand Down

0 comments on commit 0ac8373

Please sign in to comment.