Is it safe to keep a file containing the virus (binary?) code on your local machine without executing it? I am testing my application against malicious file uploads and and wondering if it's safe to actually upload this virus into my application and let it store in the upload folder.
A virus binary is just like any other file. If it's not executed, then it is just data.
Note that there are other possible avenues that a virus could be activated without your consent. For example, if your computer is set up to automatically display thumbnail from an image file, and the virus exploits a buffer overflow in the image parser of the thumbnail generator, so you can accidentally execute the virus just by opening the directory where the virus is located. As long as you know the activation vector of the virus though, and you avoid those, keeping a virus file in the filesystem should be fine.
You should use an EICAR file if you want to test virus detection: