| 116 | |
| 117 | |
| 118 | def test_remove_files_when_checkout(tmp_dir, dvc, scm): |
| 119 | # add the file into a separate branch |
| 120 | scm.checkout("branch", True) |
| 121 | ret = main(["checkout", "--force"]) |
| 122 | assert ret == 0 |
| 123 | tmp_dir.dvc_gen("file_in_a_branch", "random text", commit="add file") |
| 124 | |
| 125 | # Checkout back in master |
| 126 | scm.checkout("master") |
| 127 | assert os.path.exists("file_in_a_branch") |
| 128 | |
| 129 | # Make sure `dvc checkout` removes the file |
| 130 | # self.dvc.checkout() |
| 131 | ret = main(["checkout", "--force"]) |
| 132 | assert ret == 0 |
| 133 | assert not os.path.exists("file_in_a_branch") |
| 134 | |
| 135 | |
| 136 | class TestCheckoutCleanWorkingDir: |