If I understand you, the solution is to add a resistor in series with the pin to prevent the transistor sinking too much current then set the pin high in software. You can't tell the pin to go high then read it to see if if managed to do it though. It looks like you are using a PIC but you haven't said which type, you can do this if the pin has an internal pull-up but not all PICs do on PORTA.
You can do this if you can use another PIC pin as well, use PORTA.2 as before but use say PORTA,3 to read the input, connect a resistor between them and the transistor to PORTA,3. This lets you control the pull up with bit 2 and see if it was sucessful with bit 3.
Brian.