Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
moreati committed Jan 28, 2025
1 parent 45472c6 commit 54f49a5
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .ci/ansible_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def pause_if_interactive():
with ci_lib.Fold('ansible'):
playbook = os.environ.get('PLAYBOOK', 'all.yml')
try:
ci_lib.run('./run_ansible_playbook.py %s -i "%s" %s',
ci_lib.run('python -b ./run_ansible_playbook.py %s -i "%s" %s',
playbook, HOSTS_DIR, ' '.join(sys.argv[1:]))
except:
pause_if_interactive()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
exit 1
fi
"$PYTHON" -m tox -e "${{ matrix.tox_env }}"
"$PYTHON" -b -m tox -e "${{ matrix.tox_env }}"
macos:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
PYTHON="/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7"
fi
"$PYTHON" -m tox -e "${{ matrix.tox_env }}"
"$PYTHON" -b -m tox -e "${{ matrix.tox_env }}"
# https://github.com/marketplace/actions/alls-green
check:
Expand Down
1 change: 1 addition & 0 deletions ansible_mitogen/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import traceback
import types

import mitogen
import mitogen.core
import mitogen.parent
import mitogen.service
Expand Down
5 changes: 3 additions & 2 deletions mitogen/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ def is_stdlib_path(path):

def get_child_modules(path, fullname):
"""
Return the suffixes of submodules directly neated beneath of the package
directory at `path`.
Return the suffixes for any direct submodules in package named fullname,
located at path.
:param str path:
Path to the module's source code on disk, or some PEP-302-recognized
Expand Down Expand Up @@ -1051,6 +1051,7 @@ def find_related_imports(self, fullname):
if sys.modules.get(name) is not None
and not is_stdlib_name(name)
and u'six.moves' not in name # TODO: crap
and name != u'__main__'
)
))

Expand Down
2 changes: 1 addition & 1 deletion mitogen/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ def get_boot_command(self):
# `import os` here, instead of stage 1, to save a few bytes.
# `sys.path=...` for https://github.com/python/cpython/issues/115911.
return self.get_python_argv() + [
'-c',
'-b', '-c',
'import sys;sys.path=[p for p in sys.path if p];import binascii,os,zlib;'
'exec(zlib.decompress(binascii.a2b_base64("%s")))' % (encoded.decode(),),
]
Expand Down
4 changes: 2 additions & 2 deletions run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fi
--pattern '*_test.py' \
"$@"
else
python -m unittest discover \
python -b -m unittest discover \
--start-directory "tests" \
--pattern '*_test.py' \
"$@"
Expand All @@ -61,7 +61,7 @@ fi
--pattern '*_test.py' \
"$@"
else
python -m unittest discover \
python -b -m unittest discover \
--start-directory "tests/ansible" \
--pattern '*_test.py' \
"$@"
Expand Down
3 changes: 2 additions & 1 deletion tests/ansible/run_ansible_playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
if 'ANSIBLE_ARGV' in os.environ:
args = eval(os.environ['ANSIBLE_ARGV'])
else:
args = ['ansible-playbook']
bin_dir = os.path.dirname(sys.executable)
args = ['python', '-b', os.path.join(bin_dir, 'ansible-playbook')]

args += ['-e', json.dumps(extra)]
args += sys.argv[1:]
Expand Down
9 changes: 3 additions & 6 deletions tests/jail_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def test_okay(self):
stream = self.router.stream_by_id(context.context_id)

argv = eval(context.call(os.getenv, 'ORIGINAL_ARGV'))
self.assertEqual(argv[:4], [
self.jexec_path,
'somejail',
stream.conn.options.python_path,
'-c',
])

self.assertEqual(argv[0:2], [self.jexec_path, 'somejail'])
self.assertEqual(argv[-3:-1], [stream.conn.options.python_path, '-c'])
self.assertEqual('1', context.call(os.getenv, 'THIS_IS_STUB_JEXEC'))
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ install_command =
commands_pre =
mode_debops_common: {toxinidir}/.ci/debops_common_install.py
commands =
mode_ansible: {toxinidir}/.ci/ansible_tests.py
mode_ansible: python -b {toxinidir}/.ci/ansible_tests.py
mode_debops_common: {toxinidir}/.ci/debops_common_tests.py
mode_localhost: {toxinidir}/.ci/localhost_ansible_tests.py
mode_mitogen: {toxinidir}/.ci/mitogen_tests.py
mode_localhost: python -b {toxinidir}/.ci/localhost_ansible_tests.py
mode_mitogen: python -b {toxinidir}/.ci/mitogen_tests.py
passenv =
ANSIBLE_*
HOME
Expand Down

0 comments on commit 54f49a5

Please sign in to comment.