コード例 #1
0
ファイル: store_test.py プロジェクト: lavish205/pre-commit
def test_clone_cleans_up_on_checkout_failure(store):
    try:
        # This raises an exception because you can't clone something that
        # doesn't exist!
        store.clone('/i_dont_exist_lol', 'fake_sha')
    except Exception as e:
        assert '/i_dont_exist_lol' in five.text(e)

    things_starting_with_repo = [
        thing for thing in os.listdir(store.directory)
        if thing.startswith('repo')
    ]
    assert things_starting_with_repo == []
コード例 #2
0
def test_clone_cleans_up_on_checkout_failure(store):
    try:
        # This raises an exception because you can't clone something that
        # doesn't exist!
        store.clone('/i_dont_exist_lol', 'fake_sha')
    except Exception as e:
        assert '/i_dont_exist_lol' in five.text(e)

    things_starting_with_repo = [
        thing for thing in os.listdir(store.directory)
        if thing.startswith('repo')
    ]
    assert things_starting_with_repo == []
コード例 #3
0
 def get(self):
     path = tmpdir.join(five.text(self.tmpdir_count)).strpath
     self.tmpdir_count += 1
     os.mkdir(path)
     return path
コード例 #4
0
ファイル: error_handler.py プロジェクト: bchess/pre-commit
def _to_bytes(exc):
    try:
        return bytes(exc)
    except Exception:
        return five.text(exc).encode('UTF-8')
コード例 #5
0
 def get(self):
     path = tmpdir.join(five.text(self.tmpdir_count)).strpath
     self.tmpdir_count += 1
     os.mkdir(path)
     return path
コード例 #6
0
 def get(self):
     path = os.path.join(tmpdir.strpath, five.text(self.tmpdir_count))
     self.tmpdir_count += 1
     os.mkdir(path)
     return path
コード例 #7
0
ファイル: conftest.py プロジェクト: MMontgomeryII/pre-commit
 def get(self):
     path = os.path.join(tmpdir.strpath, five.text(self.tmpdir_count))
     self.tmpdir_count += 1
     os.mkdir(path)
     return path
コード例 #8
0
def _to_bytes(exc):
    try:
        return bytes(exc)
    except Exception:
        return five.text(exc).encode('UTF-8')