Skip to content

Commit 1d6fb75

Browse files
committed
test two
1 parent 8adc1be commit 1d6fb75

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

botocore/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,9 +3583,11 @@ def __setitem__(self, cache_key, value):
35833583
temp_fd, temp_path = tempfile.mkstemp(
35843584
dir=self._working_dir, suffix='.tmp'
35853585
)
3586-
if os.name == 'posix':
3587-
os.fchmod(temp_fd, 0o600)
3588-
else:
3586+
# if os.name == 'posix':
3587+
# os.fchmod(temp_fd, 0o600)
3588+
# else:
3589+
# os.chmod(temp_path, stat.S_IREAD | stat.S_IWRITE)
3590+
if os.chmod:
35893591
os.chmod(temp_path, stat.S_IREAD | stat.S_IWRITE)
35903592
with os.fdopen(temp_fd, 'w') as f:
35913593
temp_fd = None

tests/unit/test_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,9 +3714,11 @@ def test_concurrent_writes_same_key(self):
37143714
errors = []
37153715

37163716
def write_worker(thread_id):
3717+
lock = threading.Lock()
37173718
try:
3718-
for i in range(3):
3719-
self.cache[key] = {'thread': thread_id, 'iteration': i}
3719+
with lock:
3720+
for i in range(3):
3721+
self.cache[key] = {'thread': thread_id, 'iteration': i}
37203722
except Exception as e:
37213723
errors.append(f'Thread {thread_id}: {e}')
37223724

0 commit comments

Comments
 (0)