From 5b92c758541f3d96a0ca545c22be4de7c9962e7b Mon Sep 17 00:00:00 2001 From: Drew Bollinger Date: Fri, 3 May 2024 15:34:12 -0700 Subject: [PATCH] missed updates --- requirements.txt | 1 - test/test_build.py | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index ba04984..a1ca2a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ requests==2.31.0 boto3==1.14.20 -humanize==4.4.0 stopit==1.1.2 psycopg2==2.9.9 cryptography==42.0.2 diff --git a/test/test_build.py b/test/test_build.py index 7dd526a..5f2b8a0 100644 --- a/test/test_build.py +++ b/test/test_build.py @@ -50,7 +50,7 @@ def test_it_uses_nvmrc_file_if_it_exists(self, mock_get_logger, mock_run, patch_ create_file(patch_clone_dir / NVMRC, contents='6') mock_post_metrics = Mock() - setup_node(False, None, None, mock_post_metrics, None) + setup_node(False, None, None, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-node') @@ -66,7 +66,7 @@ def test_installs_deps(self, mock_get_logger, mock_run, patch_clone_dir): create_file(patch_clone_dir / PACKAGE_LOCK) mock_post_metrics = Mock() - setup_node(False, None, None, mock_post_metrics, None) + setup_node(False, None, None, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-node') @@ -95,7 +95,7 @@ def test_returns_code_when_err(self, mock_get_logger, mock_run): mock_post_metrics = Mock() with pytest.raises(CalledProcessError): - setup_node(False, None, None, mock_post_metrics, None) + setup_node(False, None, None, mock_post_metrics) @patch('steps.build.run') @@ -222,7 +222,7 @@ def test_no_ruby_version_file(self, mock_check_supported_ruby_version, mock_get_logger, mock_run, patch_clone_dir): mock_post_metrics = Mock() - setup_ruby(False, mock_post_metrics, None) + setup_ruby(False, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-ruby') mock_logger = mock_get_logger.return_value @@ -247,7 +247,7 @@ def test_it_uses_ruby_version_if_it_exists(self, create_file(patch_clone_dir / RUBY_VERSION, version) mock_post_metrics = Mock() - setup_ruby(False, mock_post_metrics, None) + setup_ruby(False, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-ruby') @@ -271,7 +271,7 @@ def test_it_strips_and_quotes_ruby_version(self, create_file(patch_clone_dir / RUBY_VERSION, version) mock_post_metrics = Mock() - setup_ruby(False, mock_post_metrics, None) + setup_ruby(False, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-ruby') @@ -303,7 +303,7 @@ def test_it_errors_when_rvm_install_fails(self, mock_post_metrics = Mock() with pytest.raises(Exception) as einfo: - setup_ruby(False, mock_post_metrics, None) + setup_ruby(False, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-ruby') @@ -542,9 +542,10 @@ def test_it_is_callable(self, mock_get_logger, mock_run, patch_working_dir, patc create_file(patch_clone_dir / HUGO_VERSION, version) + mock_post_metrics = Mock() with requests_mock.Mocker() as m: m.get(dl_url, text='fake-data') - download_hugo() + download_hugo(mock_post_metrics) mock_get_logger.assert_called_once_with('download-hugo') @@ -573,6 +574,7 @@ def test_it_is_callable_retry(self, mock_get_logger, mock_run, patch_working_dir create_file(patch_clone_dir / HUGO_VERSION, version) + mock_post_metrics = Mock() with requests_mock.Mocker() as m: m.get(dl_url, [ dict(exc=requests.exceptions.ConnectTimeout), @@ -582,7 +584,7 @@ def test_it_is_callable_retry(self, mock_get_logger, mock_run, patch_working_dir dict(text='fake-data') ]) - download_hugo() + download_hugo(mock_post_metrics) mock_get_logger.assert_called_once_with('download-hugo') @@ -612,6 +614,7 @@ def test_it_is_exception(self, mock_get_logger, mock_run, patch_working_dir, pat create_file(patch_clone_dir / HUGO_VERSION, version) + mock_post_metrics = Mock() with pytest.raises(Exception): with requests_mock.Mocker() as m: m.get(dl_url, [ @@ -622,7 +625,7 @@ def test_it_is_exception(self, mock_get_logger, mock_run, patch_working_dir, pat dict(exc=requests.exceptions.ConnectTimeout), ]) - download_hugo() + download_hugo(mock_post_metrics) mock_get_logger.assert_called_once_with('download-hugo') @@ -807,7 +810,7 @@ def test_it_uses_node_cache_when_package_lock(self, mock_sp_run, mock_cache_fold create_file(patch_clone_dir / PACKAGE_LOCK, contents='hashable') mock_post_metrics = Mock() - setup_node(True, None, None, mock_post_metrics, None) + setup_node(True, None, None, mock_post_metrics) mock_get_logger.assert_called_once_with('setup-node')