nitunit: set NIT_TESTING_PATH before running a test suite
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 28 Nov 2016 21:11:16 +0000 (16:11 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 28 Nov 2016 21:11:16 +0000 (16:11 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/testing/testing_suite.nit

index 5112d2f..e788067 100644 (file)
@@ -129,6 +129,7 @@ class TestSuite
 
        # Execute the test suite
        fun run do
+               set_env
                show_status
                if not toolcontext.test_dir.file_exists then
                        toolcontext.test_dir.mkdir
@@ -214,6 +215,13 @@ class TestSuite
                end
        end
 
+       # Set environment variables for test suite execution
+       fun set_env do
+               var loc = mmodule.location.file
+               if loc == null then return
+               toolcontext.set_testing_path(loc.filename)
+       end
+
        # Error occured during test-suite compilation.
        var failure: nullable String = null
 end