1
1
from __future__ import annotations
2
2
3
+ import os
3
4
import re
4
5
import sys
5
6
import unittest
@@ -786,6 +787,7 @@ def test_no_changes(self, version_mock, print_mock, _):
786
787
}
787
788
),
788
789
)
790
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'true' })
789
791
@patch ('os.chdir' , new = MagicMock ())
790
792
def test_changes_new_commit_first_repo (self , version_mock , print_mock , _ ):
791
793
with mock_git_clone ():
@@ -796,6 +798,8 @@ def test_changes_new_commit_first_repo(self, version_mock, print_mock, _):
796
798
c = MockContext (
797
799
run = {
798
800
'git rev-parse --abbrev-ref HEAD' : Result ("main" ),
801
+ 'git config user.name github-actions[bot]' : Result ("" ),
802
+ 'git config user.email github-actions[bot]@users.noreply.github.com' : Result ("" ),
799
803
'git ls-remote -h https://github.com/DataDog/omnibus-software "refs/heads/main"' : Result (
800
804
"4n0th3rc0mm1t9 refs/heads/main"
801
805
),
@@ -867,6 +871,7 @@ def test_changes_new_commit_first_repo(self, version_mock, print_mock, _):
867
871
),
868
872
)
869
873
@patch ('os.chdir' , new = MagicMock ())
874
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'false' })
870
875
def test_changes_new_commit_all_repo (self , version_mock , print_mock , _ ):
871
876
with mock_git_clone ():
872
877
next = MagicMock ()
@@ -1018,6 +1023,7 @@ def test_changes_new_release_one_repo(self, version_mock, print_mock, _):
1018
1023
}
1019
1024
),
1020
1025
)
1026
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'true' })
1021
1027
@patch ('os.chdir' , new = MagicMock ())
1022
1028
def test_changes_new_commit_second_repo_branch_out (self , version_mock , print_mock , _ ):
1023
1029
with mock_git_clone ():
@@ -1028,6 +1034,8 @@ def test_changes_new_commit_second_repo_branch_out(self, version_mock, print_moc
1028
1034
c = MockContext (
1029
1035
run = {
1030
1036
'git rev-parse --abbrev-ref HEAD' : Result ("main" ),
1037
+ 'git config user.name github-actions[bot]' : Result ("" ),
1038
+ 'git config user.email github-actions[bot]@users.noreply.github.com' : Result ("" ),
1031
1039
'git ls-remote -h https://github.com/DataDog/omnibus-software "refs/heads/7.55.x"' : Result (
1032
1040
"4n0th3rc0mm1t0 refs/heads/main"
1033
1041
),
@@ -1264,6 +1272,7 @@ def test_update_module_optional_in_agent_7(self):
1264
1272
class TestTagModules (unittest .TestCase ):
1265
1273
@patch ('tasks.release.__tag_single_module' , new = MagicMock (side_effect = [[str (i )] for i in range (2 )]))
1266
1274
@patch ('tasks.release.agent_context' , new = MagicMock ())
1275
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'false' })
1267
1276
def test_2_tags (self ):
1268
1277
c = MockContext (run = Result ("yolo" ))
1269
1278
with patch ('tasks.release.get_default_modules' ) as mock_modules :
@@ -1276,6 +1285,7 @@ def test_2_tags(self):
1276
1285
1277
1286
@patch ('tasks.release.__tag_single_module' , new = MagicMock (side_effect = [[str (i )] for i in range (3 )]))
1278
1287
@patch ('tasks.release.agent_context' , new = MagicMock ())
1288
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'false' })
1279
1289
def test_3_tags (self ):
1280
1290
c = MockContext (run = Result ("yolo" ))
1281
1291
with patch ('tasks.release.get_default_modules' ) as mock_modules :
@@ -1288,6 +1298,7 @@ def test_3_tags(self):
1288
1298
1289
1299
@patch ('tasks.release.__tag_single_module' , new = MagicMock (side_effect = [[str (i )] for i in range (4 )]))
1290
1300
@patch ('tasks.release.agent_context' , new = MagicMock ())
1301
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'false' })
1291
1302
def test_4_tags (self ):
1292
1303
c = MockContext (run = Result ("yolo" ))
1293
1304
with patch ('tasks.release.get_default_modules' ) as mock_modules :
@@ -1304,6 +1315,7 @@ def test_4_tags(self):
1304
1315
1305
1316
@patch ('tasks.release.__tag_single_module' , new = MagicMock (side_effect = [[str (i )] for i in range (100 )]))
1306
1317
@patch ('tasks.release.agent_context' , new = MagicMock ())
1318
+ @patch .dict (os .environ , {'GITHUB_ACTIONS' : 'false' })
1307
1319
def test_100_tags (self ):
1308
1320
c = MockContext (run = Result ("yolo" ))
1309
1321
with patch ('tasks.release.get_default_modules' ) as mock_modules :
0 commit comments