test_working_directory.py (1162B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 import mozunit 6 7 from mozversioncontrol import get_repository_object 8 9 STEPS = { 10 "hg": [ 11 """ 12 echo "bar" >> bar 13 echo "baz" > baz 14 hg rm foo 15 """, 16 """ 17 hg commit -m "Remove foo; modify bar; touch baz (but don't add it)" 18 """, 19 ], 20 "git": [ 21 """ 22 echo "bar" >> bar 23 echo "baz" > baz 24 git rm foo 25 """, 26 """ 27 git commit -am "Remove foo; modify bar; touch baz (but don't add it)" 28 """, 29 ], 30 "jj": [], 31 } 32 33 34 def test_working_directory_clean_untracked_files(repo): 35 if repo.vcs == "jj": 36 return 37 38 vcs = get_repository_object(repo.dir) 39 assert vcs.working_directory_clean() 40 41 repo.execute_next_step() 42 assert not vcs.working_directory_clean() 43 44 repo.execute_next_step() 45 assert vcs.working_directory_clean() 46 assert not vcs.working_directory_clean(untracked=True) 47 48 49 if __name__ == "__main__": 50 mozunit.main()