mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Don't nuke our multiprocessing efforts objc!
This commit is contained in:
parent
3fc9d13046
commit
635e7f2b33
1 changed files with 31 additions and 15 deletions
46
noxfile.py
46
noxfile.py
|
@ -350,19 +350,23 @@ def _run_with_coverage(session, *test_cmd):
|
|||
python_path_entries.remove(SITECUSTOMIZE_DIR)
|
||||
python_path_entries.insert(0, SITECUSTOMIZE_DIR)
|
||||
python_path_env_var = os.pathsep.join(python_path_entries)
|
||||
|
||||
env = {
|
||||
# The updated python path so that sitecustomize is importable
|
||||
'PYTHONPATH': python_path_env_var,
|
||||
# The full path to the .coverage data file. Makes sure we always write
|
||||
# them to the same directory
|
||||
'COVERAGE_FILE': os.path.abspath(os.path.join(REPO_ROOT, '.coverage')),
|
||||
# Instruct sub processes to also run under coverage
|
||||
'COVERAGE_PROCESS_START': os.path.join(REPO_ROOT, '.coveragerc')
|
||||
}
|
||||
if IS_DARWIN:
|
||||
# Don't nuke our multiprocessing efforts objc!
|
||||
# https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
|
||||
env['OBJC_DISABLE_INITIALIZE_FORK_SAFETY'] = 'YES'
|
||||
|
||||
try:
|
||||
session.run(
|
||||
*test_cmd,
|
||||
env={
|
||||
# The updated python path so that sitecustomize is importable
|
||||
'PYTHONPATH': python_path_env_var,
|
||||
# The full path to the .coverage data file. Makes sure we always write
|
||||
# them to the same directory
|
||||
'COVERAGE_FILE': os.path.abspath(os.path.join(REPO_ROOT, '.coverage')),
|
||||
# Instruct sub processes to also run under coverage
|
||||
'COVERAGE_PROCESS_START': os.path.join(REPO_ROOT, '.coveragerc')
|
||||
}
|
||||
)
|
||||
session.run(*test_cmd, env=env)
|
||||
finally:
|
||||
# Always combine and generate the XML coverage report
|
||||
try:
|
||||
|
@ -394,7 +398,13 @@ def _runtests(session, coverage, cmd_args):
|
|||
if coverage is True:
|
||||
_run_with_coverage(session, 'coverage', 'run', os.path.join('tests', 'runtests.py'), *cmd_args)
|
||||
else:
|
||||
session.run('python', os.path.join('tests', 'runtests.py'), *cmd_args)
|
||||
cmd_args = ['python', os.path.join('tests', 'runtests.py')] + list(cmd_args)
|
||||
env = None
|
||||
if IS_DARWIN:
|
||||
# Don't nuke our multiprocessing efforts objc!
|
||||
# https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
|
||||
env = {'OBJC_DISABLE_INITIALIZE_FORK_SAFETY': 'YES'}
|
||||
session.run(*cmd_args, env=env)
|
||||
except CommandFailed:
|
||||
# Disabling re-running failed tests for the time being
|
||||
raise
|
||||
|
@ -845,11 +855,17 @@ def _pytest(session, coverage, cmd_args):
|
|||
# Create required artifacts directories
|
||||
_create_ci_directories()
|
||||
|
||||
env = None
|
||||
if IS_DARWIN:
|
||||
# Don't nuke our multiprocessing efforts objc!
|
||||
# https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
|
||||
env = {'OBJC_DISABLE_INITIALIZE_FORK_SAFETY': 'YES'}
|
||||
|
||||
try:
|
||||
if coverage is True:
|
||||
_run_with_coverage(session, 'coverage', 'run', '-m', 'py.test', *cmd_args)
|
||||
else:
|
||||
session.run('py.test', *cmd_args)
|
||||
session.run('py.test', *cmd_args, env=env)
|
||||
except CommandFailed:
|
||||
# Re-run failed tests
|
||||
session.log('Re-running failed tests')
|
||||
|
@ -857,7 +873,7 @@ def _pytest(session, coverage, cmd_args):
|
|||
if coverage is True:
|
||||
_run_with_coverage(session, 'coverage', 'run', '-m', 'py.test', *cmd_args)
|
||||
else:
|
||||
session.run('py.test', *cmd_args)
|
||||
session.run('py.test', *cmd_args, env=env)
|
||||
|
||||
|
||||
def _lint(session, rcfile, flags, paths):
|
||||
|
|
Loading…
Add table
Reference in a new issue