Exemplo n.º 1
0
 def test_get_j_arg_live(self):
     localbuild = Localbuild([])
     # Rather than calculating the amount of RAM on this system and
     # basically re-implementing the entire code here to get the exact
     # expected result, just pattern-match for basic sanity.
     result = localbuild._get_j_arg(cpus=1)
     assert re.match('-j\d+$', result)
Exemplo n.º 2
0
 def test_get_j_arg_live(self):
     localbuild = Localbuild([])
     # Rather than calculating the amount of RAM on this system and
     # basically re-implementing the entire code here to get the exact
     # expected result, just pattern-match for basic sanity.
     result = localbuild._get_j_arg(cpus=1)
     assert re.match(r'-j\d+$', result)
Exemplo n.º 3
0
 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']
Exemplo n.º 4
0
 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'
     ]
Exemplo n.º 5
0
 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']
Exemplo n.º 6
0
 def test_get_j_arg(self, cpus, ram, expected):
     localbuild = Localbuild([])
     result = localbuild._get_j_arg(cpus=cpus, total_ram_gb=ram)
     assert result == expected
Exemplo n.º 7
0
 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)
Exemplo n.º 8
0
 def test_get_j_arg(self, cpus, ram, expected):
     localbuild = Localbuild([])
     result = localbuild._get_j_arg(cpus=cpus, total_ram_gb=ram)
     assert result == expected
Exemplo n.º 9
0
 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)
Exemplo n.º 10
0
 def test_get_j_arg(self, cpus, ram, expected, monkeypatch):
     monkeypatch.setenv('HOME', FIXTURES_DIR)
     localbuild = Localbuild(())
     result = localbuild._get_j_arg(cpus=cpus, total_ram_gb=ram)
     assert result == expected
Exemplo n.º 11
0
 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)