I'm trying to run Python tests with Tox on Windows with environmental variables like this:
set APP=c:\path\to\app\n-starting-folder\app.apk & tox -- report.xml tests/someTest.py
And in the setUp()
method i retrieve the values from environmental variables:
capabilities = {}
capabilities['app'] = os.getenv('APP')
This gives me error that the path is wrong:
error: Failed to start an Appium session, err was: Error: Bad app: c:\path\to\app\n-starting-folder\app.apk . App paths need to be absolute, or relative to the appium server install dir, or a URL to compressed file, or a special app name. cause: Error: Using local app, but didn't end in .zip, .ipa or .apk
But if I put (exactly the same) path directly into the setUp()
method as a raw string literal then no error:
capabilities['app']=r'c:\path\to\app\n-starting-folder\app.apk'
So my question is: why are values from environment variables getting mangled somehow? I suspect this is because there is an "\n"
in the path, but I don't know how to escape it properly.