In the standard cosmological framework, the Hubble diagram is interpreted by assuming that the light emitted by standard candles propagates in a spatially homogeneous and isotropic spacetime. However, the light from "point sources"-such as supernovae-probes the Universe on scales where the homogeneity principle is no longer valid. Inhomogeneities are expected to induce a bias and a dispersion of the Hubble diagram. This is investigated by considering a Swiss-cheese cosmological model, which (1) is an exact solution of the Einstein field equations, (2) is strongly inhomogeneous on small scales, but (3) has the same expansion history as a strictly homogeneous and isotropic universe. By simulating Hubble diagrams in such models, we quantify the influence of inhomogeneities on the measurement of the cosmological parameters. Though significant in general, the effects reduce drastically for a universe dominated by the cosmological constant.