Heterogeneous diffusion processes can be well described by an overdamped Langevin equation with space-dependent diffusivity D(x). We investigate the ergodic and non-ergodic behavior of these processes in an arbitrary potential well U(x) in terms of the observable-occupation time. Since our main concern is the large-x behavior for long times, the diffusivity and potential are, respectively, assumed as the power-law forms D(x) = D 0 |x| α and U(x) = U 0 |x| β for simplicity. Based on the competition roles played by D(x) and U(x), three different cases, β > α, β = α, and β < α, are discussed. The system is ergodic for the first case β > α, where the time average agrees with the ensemble average, being both determined by the steady solution for long times. In contrast, the system is non-ergodic for β < α, where the relation between time average and ensemble average is uncovered by infinite-ergodic theory. For the middle case β = α, the ergodic property, depending on the prefactors D 0 and U 0 , becomes more delicate. The probability density distribution of the time averaged occupation time for three different cases are also evaluated from Monte Carlo simulations.