3 weeks after sex
A urine pregnancy test
done correctly will give a reliable result 3 weeks after sex
(or when conception might have happened) or 1 week after missing a period.
If done sooner, a positive result is likely real, but a negative result may be due to testing too soon, and therefore lead to a repeat test. If a woman has her normal regular period, then she is not pregnant, and the test is not needed yet.