Closed rpappalax closed 8 years ago
per @pdehaan, we should also have users specify multiple pref files like so ff -s dir1/prefs.ini -s dir2/prefs.ini, instead of recursively searching through parent directories to concatenate prefs together
Before I lose my links and context:
https://docs.python.org/2/library/argparse.html
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-d', help='Add multiple config files', action='append')
parser.add_argument('-b', help='bar help')
args = parser.parse_args()
print(args)
$ python test.py
Namespace(b=None, s=None)
$ python test.py -d pocket
Namespace(b=None, d=['pocket'])
$ python test.py -d pocket -d pocket/e2e-test
Namespace(b=None, d=['pocket', 'pocket/e2e-test'])
This will allow users to specify as many random config files as they want (and at any location/depth) and not limited to a strict /{product}/{test-type}/config.ini structure. Downside is that this may cause some issues with specifying pref paths like "pocket/e2e-test" with directory separators that may be incompatible w/ Windows+Mac+Linux. But we can burn that bridge when we get to it.
Downside is that this may cause some issues with specifying pref paths like "pocket/e2e-test" with directory separators that may be incompatible w/ Windows+Mac+Linux.
yea, good catch. note to self: verify this on WinSrv before closing this issue.
I don't know Python (shocker!), but this looks pretty tempting: https://docs.python.org/2/library/os.path.html#os.path.normpath
os.path.normpath(path)
Normalize a pathname by collapsing redundant separators and up-level references so that
A//B
,A/B/
,A/./B
andA/foo/../B
all becomeA/B
. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to backward slashes. To normalize case, usenormcase()
.
👍
🍐 programming!
:hummus: programming
an additional feature I've added would work like this:
$ python test.py -d pocket -d pocket/e2e-test:stage
would choose the prefs from pocket, but then only the prefs in the [stage] section in pocket/e2e-test You could even specify more than one section like so... Imagine your e2e-prefs consist of 3 sections: fruits, vegetables, junk-food You could do this:
$ python test.py -d pocket -d pocket/e2e-test:fruits+vegetables
Which would skip the junk-food section
Currently we use a cloud-services centric way to specify a path to prefs. -a loop-server -t e2e-test would tell ff-tool to look for prefs in the following dir: ./loop-server/e2e-test/prefs.ini
However, we could make the tool more universal with something like: -d loop-server/e2e-test which would stipulate a relative path to your prefs file. there is nothing else in ff-tool specifically tied to either test-type or application.
This would also preclude users from having to clone services-test (or use exact same file structure) in order to load their own custom browser prefs