Update test.py

replace __file__ through sys.argv[0]
uses full namespace name for os.path
added automatic resource handling
removed local overwriting file builtin