Skip to content

Commit

Permalink
Complete update-checkout stash test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricerenard12 committed Apr 3, 2024
1 parent dea09e1 commit a82514f
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions utils/update_checkout/tests/test_stash.py
@@ -0,0 +1,42 @@
# ===--- test_stash.py -----------------------------------------------------===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https:#swift.org/LICENSE.txt for license information
# See https:#swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# ===----------------------------------------------------------------------===#

from . import scheme_mock
import os

class StashTestCase(scheme_mock.SchemeMockTestCase):
def __init__(self, *args, **kwargs):
super(StashTestCase, self).__init__(*args, **kwargs)

def test_stash_untracked_files(self):
self.call([self.update_checkout_path,
'--config', self.config_path,
'--source-root', self.source_root,
'--clone'])

for repo in self.get_all_repos():
repo_path = os.path.join(self.source_root, repo)
with open(os.path.join(repo_path, 'untracked_file.txt'), 'w') as f:
f.write('This is an untracked file.')

self.call([self.update_checkout_path,
'--config', self.config_path,
'--source-root', self.source_root,
'--stash'])

for repo in self.get_all_repos():
repo_path = os.path.join(self.source_root, repo)
untracked_file_path = os.path.join(repo_path, 'untracked_file.txt')
self.assertFalse(
os.path.exists(untracked_file_path),
f"{untracked_file_path} should be stashed and not present in the working directory."
)

0 comments on commit a82514f

Please sign in to comment.