コード例 #1
0
ファイル: conftest.py プロジェクト: hhsecond/stockroom
def repo(monkeypatch, managed_tmpdir):
    cwd = Path(managed_tmpdir)
    monkeypatch.setattr(Path, 'cwd', lambda: cwd)
    cwd.joinpath(".git").mkdir()
    cwd.joinpath(".gitignore").touch()
    init_repo('s', '[email protected]', overwrite=True)
    yield None
コード例 #2
0
 def test_stock_init_on_existing_hangar_repo(self, cwd):
     repo = hangar.Repository(cwd, exists=False)
     repo.init("a", "[email protected]")
     repo._env._close_environments()
     assert not cwd.joinpath("head.stock").exists()
     init_repo()
     assert cwd.joinpath("head.stock").exists()
     with open(cwd.joinpath(".gitignore")) as f:
         assert "\n.hangar\n" in f.read()
コード例 #3
0
 def test_stock_init_on_existing_hangar_repo(self, cwd):
     repo = hangar.Repository(cwd, exists=False)
     repo.init('a', '[email protected]')
     repo._env._close_environments()
     assert not cwd.joinpath('head.stock').exists()
     init_repo()
     assert cwd.joinpath('head.stock').exists()
     with open(cwd.joinpath('.gitignore')) as f:
         assert '\n.hangar\n' in f.read()
コード例 #4
0
ファイル: test_cli.py プロジェクト: tensorwerk/stockroom
def test_get_stock_obj(managed_tmpdir, monkeypatch):
    cwd = Path(managed_tmpdir)
    monkeypatch.setattr(Path, "cwd", lambda: cwd)
    with pytest.raises(RuntimeError):
        cli.get_stock_obj(cwd)
    cwd.joinpath(".git").mkdir()
    cwd.joinpath(".gitignore").touch()
    init_repo("test", "*****@*****.**")
    stock_obj = cli.get_stock_obj(cwd)
    assert stock_obj.path == cwd
コード例 #5
0
 def test_init(self, repo_path):
     cwd = repo_path
     cwd.joinpath(".git").mkdir()
     with pytest.raises(ValueError):
         init_repo(overwrite=True)
     with pytest.raises(ValueError):
         init_repo(name="some", overwrite=True)
     with pytest.raises(ValueError):
         init_repo(email="some", overwrite=True)
     init_repo("s", "[email protected]", overwrite=True)
     with open(cwd.joinpath(".gitignore")) as f:
         assert "\n.hangar\n" in f.read()
     assert cwd.joinpath(".hangar").exists()
     assert cwd.joinpath("head.stock").exists()
コード例 #6
0
 def test_init(self, repo_path):
     cwd = repo_path
     cwd.joinpath(".git").mkdir()
     with pytest.raises(ValueError):
         init_repo(overwrite=True)
     with pytest.raises(ValueError):
         init_repo(name='some', overwrite=True)
     with pytest.raises(ValueError):
         init_repo(email='some', overwrite=True)
     init_repo('s', '[email protected]', overwrite=True)
     with open(cwd.joinpath('.gitignore')) as f:
         assert '\n.hangar\n' in f.read()
     assert cwd.joinpath('.hangar').exists()
     assert cwd.joinpath('head.stock').exists()
コード例 #7
0
ファイル: test_repository.py プロジェクト: hhsecond/stockroom
 def test_init_on_non_git_folder(self, repo_path):
     with pytest.raises(RuntimeError):
         init_repo('s', '[email protected]', overwrite=True)