More fixes for running teston from anywhere

Change-Id: I1c9ca56306698b00801cd9baccf9e1c55cf4ec25
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 49c2969..9ef8884 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -1,9 +1,5 @@
-
 # Testing the basic intent functionality of ONOS
 
-import time
-import json
-
 class FUNCintent:
 
     def __init__( self ):
@@ -13,6 +9,7 @@
         import time
         import os
         import imp
+        import re
 
         """
         - Construct tests variables
@@ -33,7 +30,7 @@
 
         # Test variables
         try:
-            main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
             gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \