title: Setup remote environment when using xdist
body: <p>I'm currently working on a project involving tests to be run at a remote host (bash).
  Unfortunately, the remote python interpreter does not respect the available site-packages (it's an embedded one: abaqus python (2.6)). Using the PYTHONPATH variable, however, works to specify local installations and makes additional packages available. Hence, on the remote machine I simply add a respective line to my .bashrc file.</p>
  
  <p>Unfortunately, when distributing tests using <em>xdist</em> only a "bare" bash is invoked, without any profile specific rcs loaded. Thus, the tests fail with some import errors as argparse, which is required by pytest is not available.</p>
  
  <p>Is there a way the setup a remote host before it starts executing any pytest code (which requires argparse)? In other words is there a way to add environment variables on the hosts before the pytest imports start?</p>
  
  <p>I tried using fixtures with session scope and <code>autouse=True</code> which (of course) didn't work. Moreover I tried something like</p>
  
  <pre class="lang-py prettyprint-override"><code># in conftest.py
  import sys    
  def pytest_configure_node():
      sys.path.insert(1, "/somepath/")
      print sys.path
  </code></pre>
  
  <p>This looks like it is executed on the remote host but <em>sys.path</em> remains the hosts one and the argparse module still cannot be imported.</p>
  
  <p>I start the tests using </p>
  
  <pre><code>py.test --tx ssh=user@server//python="abaqus613 python" -vs --dist=each --rsyncdir foo
  </code></pre>
  
  <p>This starts the right python interpreter (Python 2.6.2 for Abaqus 6.13-2), but fails with</p>
  
  <pre><code>ImportError: No module named argparse
  </code></pre>