When its ready to be driven, just take it in (don't forget proper drive it like you would break in procedure) to your nearest emissions station. don't care if the car fails as it will anyway. they wll give you 15 days to retest it without having to pay again.
take your registration and safety/IM papers to the DMV. go early too of course. when you talk to the person, be nice but tell them that you haven't driven the car for two or three years because you were slowly putting a new engine in it.
they should waive your fees for the two years, ask for your current inspection papers and give you a temp registration you will tape in the window until you get your new stickers. this is where you break the engine in and drive it until its emission status is ready. any parts place can scan this and tell you if it is ready. then go have it retested.
I've never been pulled over in an expired vehicle and I drive many of them. if you do, just tell them you're on your way to have it inspected.