本文整理汇总了Python中os.environ.pop方法的典型用法代码示例。如果您正苦于以下问题:Python environ.pop方法的具体用法?Python environ.pop怎么用?Python environ.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类os.environ
的用法示例。
在下文中一共展示了environ.pop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def handle(self):
from poetry.utils.shell import Shell
# Check if it's already activated or doesn't exist and won't be created
venv_activated = strtobool(environ.get("POETRY_ACTIVE", "0")) or getattr(
sys, "real_prefix", sys.prefix
) == str(self.env.path)
if venv_activated:
self.line(
"Virtual environment already activated: "
"<info>{}</>".format(self.env.path)
)
return
self.line("Spawning shell within <info>{}</>".format(self.env.path))
# Setting this to avoid spawning unnecessary nested shells
environ["POETRY_ACTIVE"] = "1"
shell = Shell.get()
shell.activate(self.env)
environ.pop("POETRY_ACTIVE")
示例2: test_module
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def test_module(self):
environ.pop('DJANGO_ADMINS', None)
environ.update({
'DJANGO_DEBUG': 'true',
'DJANGO_INTERNAL_IPS': '127.0.0.1, 10.0.0.1',
'DJANGO_FILE_UPLOAD_DIRECTORY_PERMISSIONS': '0o644',
'DJANGO_SECRET_KEY': '123',
})
from . import settings_example as settings
self.assertEqual(global_settings.DEBUG, False)
self.assertEqual(settings.DEBUG, True)
if django.VERSION[:2] >= (1, 9):
self.assertListEqual(settings.INTERNAL_IPS, ['127.0.0.1', '10.0.0.1'])
else:
self.assertTupleEqual(settings.INTERNAL_IPS, ('127.0.0.1', '10.0.0.1'))
self.assertIsNone(global_settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS)
self.assertEqual(settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS, 420)
示例3: pytest_sessionfinish
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def pytest_sessionfinish(session):
# pylint: disable=unused-argument
environ.pop("OPENTELEMETRY_CONTEXT")
示例4: pytest_sessionfinish
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def pytest_sessionfinish(session):
# pylint: disable=unused-argument
environ.pop("AWS_ACCESS_KEY_ID")
environ.pop("AWS_SECRET_ACCESS_KEY")
environ.pop("AWS_SECURITY_TOKEN")
environ.pop("AWS_SESSION_TOKEN")
示例5: _delete_default_filename
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def _delete_default_filename(cls):
# Remove any setting of the configuration filename from the
# environment.
environ.pop(cls.envvar, None)
示例6: test_build_play_command_default
# 需要导入模块: from os import environ [as 别名]
# 或者: from os.environ import pop [as 别名]
def test_build_play_command_default():
environ.pop('FEDIPLAY_PLAY_COMMAND')
play_command = build_play_command('Awesome Music.mp3')
assert play_command == 'ffplay -v 0 -nostats -hide_banner -autoexit -nodisp \'Awesome Music.mp3\''