def test_rm_directory(self, mock_call): """Verify the commands to delete directories.""" shell.rm('mock/dirpath') if os.name == 'nt': check_calls(mock_call, ["rmdir /Q /S mock/dirpath"]) else: check_calls(mock_call, ["rm -rf mock/dirpath"])
def test_rm_file(self, mock_call): """Verify the commands to delete files.""" shell.rm('mock/path') if os.name == 'nt': check_calls(mock_call, ["del /Q /F mock/path"]) else: check_calls(mock_call, ["rm -rf mock/path"])
def it_should_fail_on_missing_repositories(config): shell.mkdir("deps") shell.rm(os.path.join("deps", "gitman_1")) with pytest.raises(InvalidRepository): gitman.lock() expect(config.__mapper__.text).does_not_contain("<unknown>")
def it_detects_invalid_repositories(config): shell.rm(os.path.join("deps", "gitman_1", ".git")) shell.mkdir(os.path.join("deps", "gitman_1", ".git")) try: with pytest.raises(InvalidRepository): expect(gitman.install('gitman_1', depth=1)) == False finally: shell.rm(os.path.join("deps", "gitman_1"))
def it_should_fail_on_dirty_repositories(config): expect(gitman.update(depth=1, lock=False)) == True shell.rm(os.path.join("deps", "gitman_1", ".project")) try: with pytest.raises(UncommittedChanges): gitman.lock() expect(config.__mapper__.text).does_not_contain("<dirty>") finally: shell.rm(os.path.join("deps", "gitman_1"))
def it_should_fail_on_invalid_repositories(config): shell.mkdir("deps") shell.rm(os.path.join("deps", "gitman_1", ".git")) shell.mkdir(os.path.join("deps", "gitman_1", ".git")) try: with pytest.raises(InvalidRepository): gitman.lock() expect(config.datafile.text).does_not_contain("<unknown>") finally: shell.rm(os.path.join("deps", "gitman_1"))
def it_creates_missing_directories(config): shell.rm(config.location) expect(gitman.install('gitman_1', depth=1)) == True expect(os.listdir(config.location)) == ['gitman_1']
def test_rm(self, mock_call): """Verify the commands to delete files/folders.""" shell.rm('mock/name/path') assert_calls(mock_call, ["rm -rf mock/name/path"])