<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:1.2em 0px!important">Hi Harmut,</p>
<p style="margin:1.2em 0px!important">I would append the <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">os.getpid()</code> to the existing <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">HOME</code> env var, something like this:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="hljs language-python" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;background:rgb(35,36,31);color:rgb(248,248,242)">new_home = os.environ[<span class="hljs-string" style="color:rgb(230,219,116)">&quot;HOME&quot;</span>] + str(os.getpid())
subprocess.run(..., env={  **os.environ, <span class="hljs-string" style="color:rgb(230,219,116)">&quot;HOME&quot;</span>: new_home})
</code></pre>
<p style="margin:1.2em 0px!important">Hope this helps!<br>Bruno.</p>
<div title="MDH:SGkgSGFybXV0LDxkaXYgcHJvY2Vzc2VkPSJ0cnVlIj48YnI+PC9kaXY+PGRpdiBwcm9jZXNzZWQ9
InRydWUiPkkgd291bGQgYXBwZW5kIHRoZSBgb3MuZ2V0cGlkKClgIHRvIHRoZSBleGlzdGluZyBg
SE9NRWAgZW52IHZhciwgc29tZXRoaW5nIGxpa2UgdGhpczo8L2Rpdj48ZGl2IHByb2Nlc3NlZD0i
dHJ1ZSI+PGJyPjwvZGl2PjxkaXYgcHJvY2Vzc2VkPSJ0cnVlIj5gYGBweXRob248L2Rpdj48ZGl2
IHByb2Nlc3NlZD0idHJ1ZSI+bmV3X2hvbWUgPSBvcy5lbnZpcm9uWyJIT01FIl0mbmJzcDsrIHN0
cihvcy5nZXRwaWQoKSk8L2Rpdj48ZGl2IHByb2Nlc3NlZD0idHJ1ZSI+c3VicHJvY2Vzcy5ydW4o
Li4uLCBlbnY9ewoKKipvcy5lbnZpcm9uLCAiSE9NRSI6IG5ld19ob21lfSk8L2Rpdj48ZGl2IHBy
b2Nlc3NlZD0idHJ1ZSI+YGBgPC9kaXY+PGRpdiBwcm9jZXNzZWQ9InRydWUiPjxicj48L2Rpdj48
ZGl2IHByb2Nlc3NlZD0idHJ1ZSI+SG9wZSB0aGlzIGhlbHBzITwvZGl2PjxkaXYgcHJvY2Vzc2Vk
PSJ0cnVlIj5CcnVuby48L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 2, 2021 at 8:08 AM Hartmut Goebel &lt;<a href="mailto:h.goebel@crazy-compilers.com">h.goebel@crazy-compilers.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
not sure whether this is the right place to ask pytest questions.<br>
<br>
I&#39;m seeking a way to spawn (within a test-case) two processes <br>
(multiprocess), each having a different &quot;tmppath&quot;. The aim is to have a <br>
different HOME (within tmppath) set in each of the processes.<br>
<br>
Any hints? Thanks in advance.<br>
<br>
Ideally I can reuse my fixtures I already have for single-process:<br>
<br>
@pytest.hookimpl(trylast=True)  # run after configure for TempPathFactory<br>
def pytest_configure(config):<br>
     &quot;&quot;&quot;<br>
     Change HOME to point to the base directory for this test session.<br>
     &quot;&quot;&quot;<br>
     global TEST_HOME<br>
     TEST_HOME = config._tmp_path_factory.getbasetemp()<br>
     os.environ[&quot;HOME&quot;] = str(TEST_HOME)<br>
<br>
@pytest.fixture<br>
def reset_home(tmp_path):<br>
     os.environ[&quot;HOME&quot;] = str(tmp_path)<br>
<br>
-- <br>
Regards<br>
Hartmut Goebel<br>
<br>
| Hartmut Goebel          | <a href="mailto:h.goebel@crazy-compilers.com" target="_blank">h.goebel@crazy-compilers.com</a>               |<br>
| <a href="http://www.crazy-compilers.com" rel="noreferrer" target="_blank">www.crazy-compilers.com</a> | compilers which you thought are impossible |<br>
<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" rel="noreferrer" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
</blockquote></div>