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

Commit

Permalink
Update tests from CLI logging changes (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem authored Aug 8, 2023
1 parent 8f672a7 commit e240db6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion automata/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import click

# from automata.cli.cli_output_logger import CLI_OUTPUT_LEVEL, CustomLogger
from automata.cli.cli_output_logger import CLI_OUTPUT_LEVEL
from automata.cli.cli_utils import ask_choice, setup_files
from automata.cli.env_operations import (
delete_key_value,
Expand Down
17 changes: 6 additions & 11 deletions automata/tests/unit/cli/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def test_reconfigure_logging_invalid():
automata.cli.commands.configure_logging("INVALID")


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_cli_run_code_embedding():
with patch(
"automata.cli.scripts.run_code_embedding.main"
Expand All @@ -82,11 +81,10 @@ def test_cli_run_code_embedding():
)

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


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_cli_run_doc_embedding():
with patch(
"automata.cli.scripts.run_doc_embedding.main"
Expand All @@ -105,11 +103,10 @@ def test_cli_run_doc_embedding():
)

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


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_cli_run_doc_post_process():
with patch(
"automata.cli.scripts.run_doc_post_process.main"
Expand All @@ -126,11 +123,10 @@ def test_cli_run_doc_post_process():
)

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


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_cli_run_agent():
with patch("automata.cli.scripts.run_agent.main") as mock_main, patch(
"automata.cli.commands.configure_logging"
Expand All @@ -145,7 +141,7 @@ def test_cli_run_agent():
)

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


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


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_reconfigure_logging_quiet_libraries():
with patch(
"automata.cli.commands.get_logging_config"
Expand All @@ -188,7 +183,7 @@ def test_reconfigure_logging_quiet_libraries():
)
mock_dictConfig.assert_called_once_with({})
assert (
mock_getLogger.call_count == 5
) # 4 for external libraries, 1 for __name__
mock_getLogger.call_count == 6
) # 5 for external libraries, 1 for __name__

mock_logger.setLevel.assert_called_with(logging.INFO)
3 changes: 0 additions & 3 deletions automata/tests/unit/cli/test_cli_env_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def test_load_env_vars(dotenv_path, default_keys):
mock_replace_key.assert_has_calls(calls, any_order=True)


@pytest.mark.skip(reason="Fix w/ Nolans next PR.")
def test_show_key_value(dotenv_path):
with patch(
"automata.cli.env_operations.get_key", return_value="value"
Expand All @@ -73,7 +72,6 @@ def test_show_key_value(dotenv_path):
mock_log.assert_called_once_with("The value of KEY is: value")


@pytest.mark.skip(reason="Fix w/ Nolans next PR.")
def test_update_key_value(dotenv_path):
with patch("automata.cli.env_operations.input", return_value="new"), patch(
"automata.cli.env_operations.replace_key"
Expand All @@ -85,7 +83,6 @@ def test_update_key_value(dotenv_path):
mock_log.assert_called_once_with("The value of KEY has been updated.")


@pytest.mark.skip(reason="Fix w/ Nolans next PR.")
def test_delete_key_value(dotenv_path):
with patch("automata.cli.env_operations.input", return_value="y"), patch(
"automata.cli.env_operations.replace_key"
Expand Down
3 changes: 1 addition & 2 deletions automata/tests/unit/cli/test_cli_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def test_common_options_project_name(command_with_options):
assert project_name_option.default == "automata"


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_common_options_log_level(command_with_options):
log_level_option = command_with_options.params[3]
assert log_level_option.name == "log_level"
assert log_level_option.default == "DEBUG"
assert log_level_option.default == "INFO"
3 changes: 1 addition & 2 deletions automata/tests/unit/symbol/test_symbol_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def test_build_real_graph(static_indices_graph_dynamic, sync_context): # noqa
assert len(all_symbols) == 1_874


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_build_real_graph_and_subgraph(
static_indices_graph_dynamic, sync_context # noqa
): # noqa
Expand All @@ -41,5 +40,5 @@ def test_build_real_graph_and_subgraph(

# build the subgraph
subgraph = static_indices_graph_dynamic.default_rankable_subgraph
assert len(subgraph) == 46
assert len(subgraph) == 43
py_module_loader.reset()
3 changes: 1 addition & 2 deletions automata/tests/unit/symbol/test_symbol_graph_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def test_build_real_graph(static_indices_graph_static, sync_context): # noqa
assert len(all_symbols) == 1_874


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_build_real_graph_and_subgraph(
static_indices_graph_static, sync_context # noqa
): # noqa
Expand All @@ -41,5 +40,5 @@ def test_build_real_graph_and_subgraph(

# build the subgraph
subgraph = static_indices_graph_static.default_rankable_subgraph
assert len(subgraph) == 46
assert len(subgraph) == 43
py_module_loader.reset()
1 change: 0 additions & 1 deletion automata/tests/unit/symbol/test_symbol_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def symbol_graph_mocked_index():
return graph


@pytest.mark.skip(reason="Logging changes broke test, need to fix")
def test_subgraph_pickle_creation(symbol_graph_mocked_index):
symbol_graph_mocked_index.default_rankable_subgraph

Expand Down

0 comments on commit e240db6

Please sign in to comment.