Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Update notebook for tests (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem authored Aug 8, 2023
1 parent 869c44a commit a33acb6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 488 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN poetry install
RUN echo "#!/bin/bash\n\
set -e\n\
poetry run automata configure --GITHUB_API_KEY=\$GITHUB_API_KEY --OPENAI_API_KEY=\$OPENAI_API_KEY\n\
poetry run automata install-indexing --from-docker=TRUE\n\
poetry run automata install-indexing --from-docker\n\
poetry run automata run-code-embedding\n\
poetry run automata run-doc-embedding --embedding-level=2\n\
exec \"\$@\"" > entrypoint.sh
Expand Down
26 changes: 12 additions & 14 deletions automata/tests/unit/cli/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def runner():
return click.testing.CliRunner()


def test_reconfigure_logging_debug():
def test_configure_logging_debug():
with patch(
"automata.cli.commands.get_logging_config"
) as mock_get_logging_config, patch(
Expand All @@ -48,7 +48,7 @@ def test_reconfigure_logging_debug():
mock_dictConfig.assert_called_once_with({})


def test_reconfigure_logging_info():
def test_configure_logging_info():
with patch(
"automata.cli.commands.get_logging_config"
) as mock_get_logging_config, patch(
Expand All @@ -60,7 +60,7 @@ def test_reconfigure_logging_info():
mock_dictConfig.assert_called_once_with({})


def test_reconfigure_logging_invalid():
def test_configure_logging_invalid():
with pytest.raises(ValueError):
automata.cli.commands.configure_logging("INVALID")

Expand All @@ -70,7 +70,7 @@ def test_cli_run_code_embedding():
"automata.cli.scripts.run_code_embedding.main"
) as mock_main, patch(
"automata.cli.commands.configure_logging"
) as mock_reconfigure_logging, patch(
) as mock_configure_logging, patch(
"logging.getLogger"
) as mock_getLogger:
mock_getLogger.return_value = MagicMock(spec=logging.Logger)
Expand All @@ -81,7 +81,7 @@ def test_cli_run_code_embedding():
)

assert result.exit_code == 0
mock_reconfigure_logging.assert_called_once_with(log_level_str="INFO")
mock_configure_logging.assert_called_once_with(log_level_str="INFO")
mock_main.assert_called_once()


Expand All @@ -90,7 +90,7 @@ def test_cli_run_doc_embedding():
"automata.cli.scripts.run_doc_embedding.main"
) as mock_main, patch(
"automata.cli.commands.configure_logging"
) as mock_reconfigure_logging, patch(
) as mock_configure_logging, patch(
"logging.getLogger"
) as mock_getLogger:
mock_getLogger.return_value = MagicMock(spec=logging.Logger)
Expand All @@ -103,7 +103,7 @@ def test_cli_run_doc_embedding():
)

assert result.exit_code == 0
mock_reconfigure_logging.assert_called_once_with(log_level_str="INFO")
mock_configure_logging.assert_called_once_with(log_level_str="INFO")
assert mock_main.called


Expand All @@ -112,7 +112,7 @@ def test_cli_run_doc_post_process():
"automata.cli.scripts.run_doc_post_process.main"
) as mock_main, patch(
"automata.cli.commands.configure_logging"
) as mock_reconfigure_logging, patch(
) as mock_configure_logging, patch(
"logging.getLogger"
) as mock_getLogger:
mock_getLogger.return_value = MagicMock(spec=logging.Logger)
Expand All @@ -123,16 +123,14 @@ def test_cli_run_doc_post_process():
)

assert result.exit_code == 0
mock_reconfigure_logging.assert_called_once_with(log_level_str="INFO")
mock_configure_logging.assert_called_once_with(log_level_str="INFO")
mock_main.assert_called_once()


def test_cli_run_agent():
with patch("automata.cli.scripts.run_agent.main") as mock_main, patch(
"automata.cli.commands.configure_logging"
) as mock_reconfigure_logging, patch(
"logging.getLogger"
) as mock_getLogger:
) as mock_configure_logging, patch("logging.getLogger") as mock_getLogger:
mock_getLogger.return_value = MagicMock(spec=logging.Logger)

runner = click.testing.CliRunner()
Expand All @@ -141,7 +139,7 @@ def test_cli_run_agent():
)

assert result.exit_code == 0
mock_reconfigure_logging.assert_called_once_with(log_level_str="INFO")
mock_configure_logging.assert_called_once_with(log_level_str="INFO")
assert mock_main.called


Expand All @@ -164,7 +162,7 @@ def test_configure_load_env_vars_called(load_env_vars_mock):
)


def test_reconfigure_logging_quiet_libraries():
def test_configure_logging_quiet_libraries():
with patch(
"automata.cli.commands.get_logging_config"
) as mock_get_logging_config, patch(
Expand Down
Loading

0 comments on commit a33acb6

Please sign in to comment.