Permalink
Browse files

Another try at radiasoft/sirepo#905

One of the pytest authors responded:
pytest-dev/pytest#935 (comment)
There's no way to force dependencies for pytest plugins.
  • Loading branch information...
robnagler committed Oct 6, 2017
1 parent 6f5fe94 commit de0ef4510abc801f6ec7183bd50bc5d56465c146
Showing with 29 additions and 8 deletions.
  1. +3 −0 pykern/package_data/projex/tests/conftest.py.jinja
  2. +13 −2 pykern/pytest_plugin.py
  3. +3 −3 setup.py
  4. +3 −0 tests/conftest.py
  5. +7 −3 tests/pkdebug_test.py
@@ -0,0 +1,3 @@
# This avoids a plugin dependency issue with pytest-forked/xdist:
# https://github.com/pytest-dev/pytest/issues/935
pytest_plugins = ['pykern.pytest_plugin']
View
@@ -44,12 +44,23 @@ def pytest_configure(config):
root_d = _setup_py_parser()
if not root_d:
return
import os
if not os.environ.get('PYKERN_PKDEBUG_OUTPUT'):
# Work around https://github.com/pytest-dev/pytest/issues/1693
# xdist/forked don't allow capture. It's too hard to debug
# without seeing output
os.environ['PYKERN_PKDEBUG_OUTPUT'] = '/dev/stderr'
from pykern import pkconfig
pkconfig.append_load_path(root_d.basename)
import os
if hasattr(os, 'fork'):
config._parser.parse_setoption(['--forked'], config.option, namespace=config.option)
#norecursedirs = *_data *_work
config._parser.parse_setoption(
# run each test file in a separate process
# the native trace works better, e.g. for emacs
['--forked', '--tb=native'],
config.option,
namespace=config.option,
)
@pytest.hookimpl(tryfirst=True)
View
@@ -24,9 +24,9 @@
'oauthenticator',
],
},
entry_points={
'pytest11': ['pykern = pykern.pytest_plugin'],
},
# entry_points={
# 'pytest11': ['pykern = pykern.pytest_plugin'],
# },
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
View
@@ -0,0 +1,3 @@
# This avoids a plugin dependency issue with pytest-forked/xdist:
# https://github.com/pytest-dev/pytest/issues/935
pytest_plugins = ['pykern.pytest_plugin']
View
@@ -13,11 +13,15 @@
import re
import six
# Do not import anything from pk be fresh
# Do not import anything from pykern so config can be fresh
# Test without logging redirects, because need to test native and then
# test _logging_uninstall()
os.environ['PYKERN_PKDEBUG_REDIRECT_LOGGING'] = ''
# test _logging_uninstall(). Need to clear any output or controls
os.environ.update(
PYKERN_PKDEBUG_REDIRECT_LOGGING='',
PYKERN_PKDEBUG_OUTPUT='',
PYKERN_PKDEBUG_CONTROL='',
)
def test_init(capsys):
from pykern import pkunit

0 comments on commit de0ef45

Please sign in to comment.