mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-29 20:23:01 +02:00
Using `sys.argv[0]` does not quite achieve the effect we want, namely
that any (test-case, $PYTHONHASHSEED) tuple should always default to
the same transport.
For example, the following two examples should always use the same
transport:
$ make PYTHONHASHSEED=1337 test-sh
infamy0:test$ ./case/ietf_system/hostname/test.py
$ make PYTHONHASHSEED=1337 test-sh
infamy0:test$ cd ./case/ietf_system/hostname
infamy0:hostname$ ./test.py
But, since their argv[0]'s are different, they don't.
Therefore use the _last two components_ of argv[0]'s full path
instead. This should:
- Spread the allocation over an entire suite run, since the
penultimate component is usually the test name.
- Keep the allocation stable when test code is modified (which is
common during debugging of failing tests)
- Avoid instabilities stemming from the local storage location (i.e.,
home directory names etc.)