New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using xdist with libfaketime #56
Comments
this one needs extra support, atm execnet does set env vars after fork (ssh vs non-ssh) its not clear how to handle interpreter restart correctly off-hand, please try to get a hold of me in #pylib on freenode tommorow |
So we had a brief chat and this is difficult to tackle, especially for
The gateway name - to be decided. The timeframe - I'll sit on it around mid-week next week. Meanwhile, with some plain hacking around I verified that this plan should work - this patch and |
Hi, I'm @seporaitis' colleague. This works: libfaketime.reexec_if_needed()
os.environ['LD_PRELOAD'] = libfaketime.get_reload_information()[1]['LD_PRELOAD'] # for pytest-xdist
|
I was about to write the same :-) @adamchainz solution works on Linux. Updating
Verified that it works and I'll close the issue. |
good find, this is a entirely different kind of solution - can i rope you into providing a more complete example for xdist or pytest documentation? or perhaps even creating a pytest plugin for this |
Hi,
We would like to use python-libfaketime (a wrapper around the excellent libfaketime). It works by re-executing the interpreter with
LD_PRELOAD
environment variable pointing tolibfaketime.so
file. This works in a single-threadedpytest
run, but it fails withxdist
- after some digging it seems thatLD_PRELOAD
is not passed along to the child process. Using--dist=load --tx 2*popen//env:LD_PRELOAD=/path/to/libfaketime.so.1
does not seem to help.We've tried to run
libfaketime.reexec_if_needed
inpytest_configure
andpytest_configure_node
, but they are both executed in the parent process - thus useless. Forcinglibfaketime.reexec_if_needed
in the child produces a loop, since it re-execs the parent command:py.test
-collect tests
-initialize nodes
-reexec py.test
-...
. As well as some other attempts to makeLD_PRELOAD
reach child process - all without success.To reproduce:
files:
conftest.py
:test_issue.py
:execute:
Any tips on how to approach this would be very welcome.
The text was updated successfully, but these errors were encountered: