def test_no_args(self, capsys): clone = Clone(['rhcephpkg']) with pytest.raises(SystemExit): clone.main() out, _ = capsys.readouterr() expected = clone._help + "\n" assert out == expected
def test_already_exists(self, tmpdir, monkeypatch): tmpdir.mkdir('mypkg') monkeypatch.chdir(tmpdir) clone = Clone(['rhcephpkg', 'mypkg']) with pytest.raises(SystemExit) as e: clone.main() expected = 'mypkg already exists in current working directory.' assert str(e.value) == expected
def test_python_package(self, tmpdir, monkeypatch): recorder = CheckCallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) monkeypatch.chdir(tmpdir) clone = Clone(['rhcephpkg', 'python-apipkg']) clone.main() assert recorder.args == ['git', 'clone', 'ssh://[email protected]/ubuntu/apipkg'] assert tmpdir.join('apipkg').check(dir=1)
def test_python_package(self, tmpdir, monkeypatch): recorder = CheckCallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) monkeypatch.chdir(tmpdir) clone = Clone(['rhcephpkg', 'python-apipkg']) clone.main() assert recorder.args == [ 'git', 'clone', 'ssh://[email protected]/ubuntu/apipkg' ] assert tmpdir.join('apipkg').check(dir=1)