Caffeine can also affect the pulmonary function test by causing the airways to be more open than they would normally. Patients should avoid caffeine as well as smoking for several hours before their appointment.