How do i parameterize python tests to run for different environments using -P property

Hi,

I am new to gradle and learning it gradually.

I need to run my python integration tests via gradle on local environment and also dev env.

Goal is to run my tests from commandline against a particular env. Such as:

gradle -Penv=local pythontest

With above command, my python tests need to run on local env, url: localhost:8665/local

With:

gradle -Penv=qa pythontest

My python tests need to run on QA env: url: idp.test.solutions.net:8665/data

I so far have a task setup:

task pythontest (type: Exec) {
         workingDir './API'
         commandLine 'nosetests', '-v', 'PyAPITests.py'
         if (project.hasProperty("env")) {
             args = [env]
                         }
        }

Not able to figure out how to set my urls inside this task. Also not sure if python tests can accept the url from here.