Esempio n. 1
0
def test_builder_build_timeout(tmpdir):
    with mock.patch('tempfile.TemporaryDirectory') as tmpdir_mock, \
            mock.patch('piwheels.slave.builder.proc') as proc_mock, \
            mock.patch('piwheels.slave.builder.datetime') as time_mock:
        tmpdir_mock().name = str(tmpdir)
        proc_mock.call.side_effect = proc.TimeoutExpired(['pip3'], 300)
        now = datetime.utcnow()
        time_mock.utcnow.side_effect = [
            now, now + timedelta(seconds=100), now + timedelta(seconds=1000),
            now + timedelta(seconds=1001)]
        b = builder.Builder('foo', '0.1')
        b.start()
        b.join(1)
        assert not b.is_alive()
        assert not b.status
        args, kwargs = proc_mock.call.call_args
        assert args[0][-1] == 'foo==0.1'
        assert len(b.wheels) == 0
Esempio n. 2
0
def test_builder_dependencies_failed(mock_archive, tmpdir):
    with mock.patch('tempfile.TemporaryDirectory') as tmpdir_mock, \
            mock.patch('piwheels.slave.builder.proc.call') as call_mock, \
            mock.patch('piwheels.slave.builder.proc.check_output') as output_mock, \
            mock.patch('piwheels.slave.builder.apt') as apt_mock:
        tmpdir_mock().name = str(tmpdir)
        tmpdir_mock().__enter__.return_value = str(tmpdir)
        def call(*args, **kwargs):
            with tmpdir.join('foo-0.1-cp34-cp34m-linux_armv7l.whl').open('wb') as f:
                f.write(mock_archive)
            return 0
        call_mock.side_effect = call
        output_mock.side_effect = proc.TimeoutExpired('ldd', 30)
        b = builder.Builder('foo', '0.1')
        b.start()
        b.join(1)
        assert not b.is_alive()
        assert not b.status
        assert not b.wheels
Esempio n. 3
0
 def wait(timeout=None):
     raise proc.TimeoutExpired(args, 1)
Esempio n. 4
0
 def communicate(input=None, timeout=None):
     raise proc.TimeoutExpired(args, 1)