def test_localbuild(self, args, expected, monkeypatch): monkeypatch.setenv('HOME', FIXTURES_DIR) monkeypatch.setattr('subprocess.check_call', self.fake_check_call) monkeypatch.setattr('rhcephpkg.Localbuild._get_j_arg', lambda *a: '-j2') localbuild = Localbuild(args) localbuild.main() assert self.last_cmd == ['gbp', 'buildpackage', expected, '--git-arch=amd64', '--git-verbose', '--git-pbuilder', '-j2', '-us', '-uc']
def test_localbuild(self, testpkg, args, expected, monkeypatch): recorder = CallRecorder() monkeypatch.setattr('subprocess.check_call', recorder) monkeypatch.setattr('rhcephpkg.Localbuild._get_j_arg', lambda *a: '-j2') localbuild = Localbuild(args) localbuild.main() assert recorder.args == [ 'gbp', 'buildpackage', expected, '--git-arch=amd64', '--git-verbose', '--git-pbuilder', '-j2', '-us', '-uc' ]
def test_localbuild(self, args, expected, monkeypatch): recorder = CallRecorder() monkeypatch.setattr('rhcephpkg.localbuild.get_distro', lambda: 'trusty') monkeypatch.setattr('subprocess.check_call', recorder) monkeypatch.setattr('rhcephpkg.Localbuild._get_j_arg', lambda *a: '-j2') localbuild = Localbuild(args) localbuild.main() assert recorder.args == ['gbp', 'buildpackage', expected, '--git-arch=amd64', '--git-verbose', '--git-pbuilder', '-j2', '-us', '-uc']
def test_missing_arg(self): localbuild = Localbuild(('localbuild', '--dist')) with pytest.raises(SystemExit) as e: localbuild.main() assert 'Specify a distro to --dist' in str(e.value)
def test_missing_arg(self, monkeypatch): monkeypatch.setenv('HOME', FIXTURES_DIR) localbuild = Localbuild(('localbuild', '--dist')) with pytest.raises(SystemExit) as e: localbuild.main() assert 'Specify a distro to --dist' in str(e.value)