You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use a PEX to run tests from the pytest framework while using the pytest-xdist plugin for distributed testing.
However I believe I am facing an issue similar to this one, as my worker processes are not recognizing packages that are packaged with pex.
My pex build is configured to have pytest as a module entry point (-m pytest) and from this main process I launch the workers in python subprocesses that are instantiated with the following command pytest -d --tx popen//python=python3.
When the workers begin executing I get the error ModuleNotFoundError: No module named '_pytest' which leads me to believe that the pytest package (contained in my pex file) is not being recognized by the subprocesses.
I've tried to bootstrap the pex environment by configuring the workers before their execution in the pytest_configure_node xdist hook with a call to pex_bootstrapper.bootstrap_pex_env('my.pex') but the problem remains.
Any ideas? Thanks
The text was updated successfully, but these errors were encountered:
benjyw
pushed a commit
to benjyw/pex
that referenced
this issue
Nov 30, 2018
This PR adds a new CLI option, -p or --preamble-file, that is used to provide a preamble to the pex builder object.
We use pex via its API in the internal build tooling at NerdWallet (👋, we're neighbors!). We've been leveraging it for multi-platform support, but now that pex-tool#394 / 1.2.9 has landed the only thing missing from the CLI that we leverage is the preamble in the builder, which was pretty easy to hook up. Once this PR has landed we can remove all of the API integration and just rely on the pex CLI!
The CLI option and the PEXBuilder preamble functionality are covered by tests.
Local functional testing:
(pex-foo)
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:49:54 08.16)
pex-tool#536 ❯❯❯ echo 'print "foo!"' > preamble
(pex-foo)
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:50:11 08.16)
pex-tool#537 ❯❯❯ pex -p preamble
foo!
Python 2.7.13 (default, Jun 7 2017, 11:02:53)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
(pex-foo)
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:50:18 08.16)
pex-tool#538 ❯❯❯ pex
Python 2.7.13 (default, Jun 7 2017, 11:02:53)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
Hi,
I am trying to use a PEX to run tests from the pytest framework while using the pytest-xdist plugin for distributed testing.
However I believe I am facing an issue similar to this one, as my worker processes are not recognizing packages that are packaged with pex.
My pex build is configured to have pytest as a module entry point (
-m pytest
) and from this main process I launch the workers in python subprocesses that are instantiated with the following commandpytest -d --tx popen//python=python3
.When the workers begin executing I get the error
ModuleNotFoundError: No module named '_pytest'
which leads me to believe that the pytest package (contained in my pex file) is not being recognized by the subprocesses.I've tried to bootstrap the pex environment by configuring the workers before their execution in the
pytest_configure_node
xdist hook with a call topex_bootstrapper.bootstrap_pex_env('my.pex')
but the problem remains.Any ideas? Thanks
The text was updated successfully, but these errors were encountered: