When can I take the test?

I had sex about a week ago, and it was unprotected. He pulled out but we all know that's not always effective. So how soon can I take a pregnancy test and it be accurate? I'm supposed to start my period in like the first week of November. I don't know if that makes a difference.