When is a pulmonary function test required