How can I get my gradle test task to use python pip install for library that isn't on maven central? How can I get my gradle test task to use python pip install for library that isn't on maven central? selenium selenium

How can I get my gradle test task to use python pip install for library that isn't on maven central?


I had to use a gradle Exec task to run a python script that then kicked off the robot tests. So it looked like this:

build.gradle

task acceptanceTest(type: Exec) {    workingDir 'src/testAcceptance'    commandLine 'python', 'run.py'}

src/testAcceptance/run.py

import osimport robotimport setup #Which runs setup.pyos.environ['ROBOT_OPTIONS'] = '--variable BROWSER.gc --outputdir results'robot.run('.')

src/testAcceptance/setup.py

import osimport sysimport pipimport repip.main(['install', 'robotframework==3.0'])pip.main(['install', 'robotframework-selenium2library==1.8.0'])# Checksums can be looked up by chromedriver version here - http://chromedriver.storage.googleapis.com/index.htmlpip.main(['install', '--upgrade', 'chromedriver_installer',    '--install-option=--chromedriver-version=2.24',    '--install-option=--chromedriver-checksums=1a46c83926f891d502427df10b4646b9,d117b66fac514344eaf80691ae9a4687,' +    'c56e41bdc769ad2c31225b8495fc1a93,8e6b6d358f1b919a0d1369f90d61e1a4'])#Add the Scripts dir to the path, since that's where the chromedriver is installedscriptsDir = re.sub('[A-Za-z0-9\\.]+$', '', sys.executable) + 'Scripts'os.environ['PATH'] += os.pathsep + scriptsDir